test(unit): mock date in transaction-item test
This commit is contained in:
parent
c3f5e5293b
commit
9297166baf
|
@ -29,7 +29,7 @@ exports[`<TransactionItem /> should render a transaction item correctly 1`] = `
|
||||||
<p
|
<p
|
||||||
class="sc-kgoBCf goviHQ sc-htpNat pRhzD"
|
class="sc-kgoBCf goviHQ sc-htpNat pRhzD"
|
||||||
>
|
>
|
||||||
23:20 PM
|
17:01 PM
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -8,7 +8,21 @@ import 'jest-dom/extend-expect';
|
||||||
import { TransactionItemComponent } from '../../app/components/transaction-item';
|
import { TransactionItemComponent } from '../../app/components/transaction-item';
|
||||||
import { appTheme } from '../../app/theme';
|
import { appTheme } from '../../app/theme';
|
||||||
|
|
||||||
afterEach(cleanup);
|
let originalDate;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
originalDate = global.Date;
|
||||||
|
global.Date = class extends Date {
|
||||||
|
constructor() {
|
||||||
|
super();
|
||||||
|
return '2019-03-05T19:58:35.457Z';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
});
|
||||||
|
afterEach(() => {
|
||||||
|
global.Date = originalDate;
|
||||||
|
cleanup();
|
||||||
|
});
|
||||||
|
|
||||||
describe('<TransactionItem />', () => {
|
describe('<TransactionItem />', () => {
|
||||||
test('should render a transaction item correctly', () => {
|
test('should render a transaction item correctly', () => {
|
||||||
|
@ -19,7 +33,7 @@ describe('<TransactionItem />', () => {
|
||||||
address='123456789123456789123456789123456789'
|
address='123456789123456789123456789123456789'
|
||||||
transactionId='a0s9dujo23j0'
|
transactionId='a0s9dujo23j0'
|
||||||
amount={0.8652}
|
amount={0.8652}
|
||||||
date={new Date(Date.UTC(2018, 10, 20, 1, 20, 35)).toString()}
|
date={new Date().toString()}
|
||||||
zecPrice={2.94}
|
zecPrice={2.94}
|
||||||
fees={0.0001}
|
fees={0.0001}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue