diff --git a/components/AppHeader/AppHeader.test.tsx b/components/AppHeader/AppHeader.test.tsx new file mode 100644 index 00000000..592baa44 --- /dev/null +++ b/components/AppHeader/AppHeader.test.tsx @@ -0,0 +1,9 @@ +import { AppHeader } from 'components/AppHeader/AppHeader'; +import { render, screen } from 'setUpTest'; + +describe('AppHeader', () => { + test('har overskrift på nivå h1', () => { + render(); + expect(screen.getByRole('heading', { level: 1, name: 'Mine arbeidsavklarings­penger' })).toBeVisible(); + }); +}); diff --git a/lib/utils/date.test.ts b/lib/utils/date.test.ts new file mode 100644 index 00000000..c6fa6383 --- /dev/null +++ b/lib/utils/date.test.ts @@ -0,0 +1,27 @@ +import { formatDate, formatFullDate } from 'lib/utils/date'; + +describe('date', () => { + describe('formatFullDate', () => { + test('returnerer tom streng når dato er undefined', () => { + const resultat = formatFullDate(undefined); + expect(resultat).toBe(''); + }); + + test('returnerer dato på format dd.MM.yyyy HH:mm', () => { + const resultat = formatFullDate('2023-08-10T12:32'); + expect(resultat).toBe('10.08.2023 12:32'); + }); + }); + + describe('formatDate', () => { + test('returnerer tom streng når dato er undefined', () => { + const resultat = formatDate(undefined); + expect(resultat).toBe(''); + }); + + test('returnerer format på d. MMMM yyyy', () => { + const resultat = formatDate('2023-08-10T12:32'); + expect(resultat).toBe('10. august 2023'); + }); + }); +}); diff --git a/next-env.d.ts b/next-env.d.ts index fd36f949..4f11a03d 100755 --- a/next-env.d.ts +++ b/next-env.d.ts @@ -1,6 +1,5 @@ /// /// -/// // NOTE: This file should not be edited // see https://nextjs.org/docs/basic-features/typescript for more information.