Lint money.spec.ts
This commit is contained in:
parent
f928072c12
commit
4e51e9ecfc
2 changed files with 26 additions and 23 deletions
|
@ -6,7 +6,6 @@ log/*
|
||||||
coverage/*
|
coverage/*
|
||||||
|
|
||||||
# old ts files we want to migrate
|
# old ts files we want to migrate
|
||||||
app/javascript/common/money.spec.ts
|
|
||||||
app/javascript/donate-button/donate-button.v2.ts
|
app/javascript/donate-button/donate-button.v2.ts
|
||||||
app/javascript/legacy_react/api/api/api.ts
|
app/javascript/legacy_react/api/api/api.ts
|
||||||
app/javascript/legacy_react/api/api/NonprofitsApi.ts
|
app/javascript/legacy_react/api/api/NonprofitsApi.ts
|
||||||
|
|
|
@ -1,30 +1,34 @@
|
||||||
import {Money} from './money'
|
import { Money } from './money';
|
||||||
import 'jest';
|
|
||||||
|
|
||||||
describe("Money", () => {
|
describe("Money", () => {
|
||||||
describe('Money.fromCents',() => {
|
describe('Money.fromCents', () => {
|
||||||
it('succeeds from a old Money object', () => {
|
it('succeeds from a old Money object', () => {
|
||||||
const old = Money.fromCents(333, 'eur')
|
expect.assertions(2);
|
||||||
|
const old = Money.fromCents(333, 'eur');
|
||||||
|
|
||||||
const result = Money.fromCents(old)
|
const result = Money.fromCents(old);
|
||||||
expect(result).toEqual(old)
|
expect(result).toStrictEqual(old);
|
||||||
|
|
||||||
expect(result).not.toBe(old)
|
expect(result).not.toBe(old);
|
||||||
})
|
});
|
||||||
it('succeeds from a json', () => {
|
it('succeeds from a json', () => {
|
||||||
const old = {amount:333, currency:'eur'}
|
expect.hasAssertions();
|
||||||
|
const old = { amount: 333, currency: 'eur' };
|
||||||
|
|
||||||
const result = Money.fromCents(old)
|
const result = Money.fromCents(old);
|
||||||
expect(result).toEqual(old)
|
// eslint-disable-next-line jest/prefer-strict-equal
|
||||||
|
expect(result).toEqual(old);
|
||||||
|
|
||||||
expect(result).toBeInstanceOf(Money)
|
expect(result).toBeInstanceOf(Money);
|
||||||
})
|
});
|
||||||
|
|
||||||
it('succeeds from function parameters', () => {
|
it('succeeds from function parameters', () => {
|
||||||
const result = Money.fromCents(333, 'eur')
|
expect.hasAssertions();
|
||||||
expect(result).toEqual({amount:333, currency:'eur'})
|
const result = Money.fromCents(333, 'eur');
|
||||||
|
// eslint-disable-next-line jest/prefer-strict-equal
|
||||||
|
expect(result).toEqual({ amount: 333, currency: 'eur' });
|
||||||
|
|
||||||
expect(result).toBeInstanceOf(Money)
|
expect(result).toBeInstanceOf(Money);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
Loading…
Reference in a new issue