Skip to content

Commit

Permalink
test: Added test for overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
cmath10 committed Feb 15, 2024
1 parent a3f5463 commit 8fc6df4
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -308,4 +308,26 @@ describe('Morph', () => {
expect(date.getHours()).toEqual(10)
expect(date.getMinutes()).toEqual(30)
})

test('overrides', () => {
const morph1 = new MorphOne()
.move('_id', 'id')
.move('_name', 'name')

const morph2 = morph1.override().exclude('name')

expect(morph1.convert({
_id: 1,
_name: 'Star Wars. Episode IV: A New Hope',
})).toEqual({
id: 1,
name: 'Star Wars. Episode IV: A New Hope',
})

expect(morph2.convert({
_id: 1,
})).toEqual({
id: 1,
})
})
})

0 comments on commit 8fc6df4

Please sign in to comment.