diff --git a/src/fragmentarium/domain/archaeology.test.ts b/src/fragmentarium/domain/archaeology.test.ts new file mode 100644 index 000000000..cf69596c2 --- /dev/null +++ b/src/fragmentarium/domain/archaeology.test.ts @@ -0,0 +1,28 @@ +import { archaeologyFactory } from 'test-support/fragment-fixtures' +import { SiteKey, createArchaeology, toArchaeologyDto } from './archaeology' +import MuseumNumber, { museumNumberToString } from './MuseumNumber' + +const excavationNumber: MuseumNumber = { + prefix: 'A', + number: '38', + suffix: '', +} +const archaeology = archaeologyFactory.build({ + excavationNumber: museumNumberToString(excavationNumber), +}) + +test('toArchaeologyDto', () => { + expect(toArchaeologyDto(archaeology)).toEqual({ + ...archaeology, + site: archaeology.site?.name, + }) +}) +test('createArchaeology', () => { + expect( + createArchaeology({ + ...archaeology, + excavationNumber: excavationNumber, + site: (archaeology.site?.name || '') as SiteKey, + }) + ).toEqual(archaeology) +})