-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: rename Replacer to Serializer and Reviver to Deserializer
BREAKING CHANGE most apis are renamed
- Loading branch information
Dmitry Steblyuk
committed
Sep 8, 2021
1 parent
467ad11
commit f42021d
Showing
59 changed files
with
504 additions
and
462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {describe, it, expect} from '@jest/globals'; | ||
import {customType} from './custom-type'; | ||
import {Deserializer} from './deserializer'; | ||
|
||
describe('Deserializer', () => { | ||
it('should not allow duplicate types', () => { | ||
const combined = Deserializer.combine( | ||
Deserializer.combine( | ||
customType('type1').createDeserializer(() => null), | ||
customType('type2').createDeserializer(() => null), | ||
), | ||
Deserializer.combine( | ||
Deserializer.combine( | ||
customType('type3').createDeserializer(() => null), | ||
), | ||
customType('type4').createDeserializer(() => null), | ||
customType('type5').createDeserializer(() => null), | ||
), | ||
); | ||
expect(combined.getDeserializers().length).toBe(5); | ||
|
||
expect(() => { | ||
Deserializer.combine( | ||
combined, | ||
customType('type3').createDeserializer(() => null), | ||
); | ||
}).toThrowError(new Error('Duplicate custom type "type3".')); | ||
}); | ||
}); |
Oops, something went wrong.