Skip to content

Commit

Permalink
chore: mocks Date in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
langz committed Oct 8, 2024
1 parent 16a2f90 commit ff124f2
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import nbNO from '../../../constants/locales/nb-NO'

const nb = nbNO['nb-NO']

async function expectNever(callable: () => unknown): Promise<void> {
await expect(() => waitFor(callable)).rejects.toEqual(expect.anything())
}

describe('Field.NationalIdentityNumber', () => {
it('should render with props', () => {
const props: Props = {}
Expand Down Expand Up @@ -339,6 +343,7 @@ describe('Field.NationalIdentityNumber', () => {
})

describe('should validate if identity numbers is adult(18 years and older)', () => {
jest.useFakeTimers().setSystemTime(new Date('2024-10-07').getTime())
const fnr0YearsOld = [
'10072476609',
'29082499936',
Expand Down Expand Up @@ -392,8 +397,8 @@ describe('Field.NationalIdentityNumber', () => {
...fnr99To120YearsOld,
]

const dnrUnder18YearsOld = [...fnrUnder18YearsOld] // todo: find dnrs
const dnr18YearsOldAndOlder = [...fnr18YearsOldAndOlder] // todo: find dnrs
const dnrUnder18YearsOld = [...fnrUnder18YearsOld] // todo: replace this with actual dnrs
const dnr18YearsOldAndOlder = [...fnr18YearsOldAndOlder] // todo: replace this with actual dnrs

const validIds = [...fnr18YearsOldAndOlder, ...dnr18YearsOldAndOlder]

Expand Down

0 comments on commit ff124f2

Please sign in to comment.