Skip to content

Commit

Permalink
add test for archaeology load and dump
Browse files Browse the repository at this point in the history
  • Loading branch information
fsimonjetz committed Aug 26, 2023
1 parent 4eaa647 commit d1d23a9
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/fragmentarium/domain/archaeology.test.ts
Original file line number Diff line number Diff line change
@@ -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)
})

0 comments on commit d1d23a9

Please sign in to comment.