2020-06-10 12:42:44 +01:00
|
|
|
// Copyright (C) 2020 Storj Labs, Inc.
|
|
|
|
// See LICENSE for copying information.
|
|
|
|
|
|
|
|
import CreditsItem from '@/components/account/billing/freeCredits/CreditsItem.vue';
|
|
|
|
|
|
|
|
import { PaymentsHistoryItem, PaymentsHistoryItemType } from '@/types/payments';
|
|
|
|
import { createLocalVue, mount } from '@vue/test-utils';
|
|
|
|
|
|
|
|
const localVue = createLocalVue();
|
2020-07-08 11:33:26 +01:00
|
|
|
const coupon = new PaymentsHistoryItem('testId', 'desc', 275, 0, 'Active', '', new Date(1), new Date(1), PaymentsHistoryItemType.Coupon, 275);
|
2020-06-10 12:42:44 +01:00
|
|
|
|
|
|
|
localVue.filter('centsToDollars', (cents: number): string => {
|
|
|
|
return `$${(cents / 100).toFixed(2)}`;
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('CreditsItem', (): void => {
|
2020-07-08 11:33:26 +01:00
|
|
|
it('renders correctly', (): void => {
|
2020-06-10 12:42:44 +01:00
|
|
|
const wrapper = mount(CreditsItem, {
|
|
|
|
localVue,
|
|
|
|
propsData: {
|
2020-07-08 11:33:26 +01:00
|
|
|
creditsItem: coupon,
|
2020-06-10 12:42:44 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(wrapper).toMatchSnapshot();
|
|
|
|
});
|
|
|
|
});
|