-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ADD addon-contexts: tests on serializers
- Loading branch information
Leo Y. Li
committed
Apr 24, 2019
1 parent
d71d9de
commit d8ca8e0
Showing
1 changed file
with
19 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import { deserialize, serialize } from './serializers'; | ||
|
||
describe('Test on serializers', () => { | ||
const someContextsQueryParam = 'CSS Themes=Forests,Languages=Fr'; | ||
const someSelectionState = { | ||
'CSS Themes': 'Forests', | ||
Languages: 'Fr', | ||
}; | ||
|
||
it('Should serialize selection state into its string representation', () => { | ||
expect(serialize(null)).toEqual(null); | ||
expect(serialize(someSelectionState)).toEqual(someContextsQueryParam); | ||
}); | ||
|
||
it('Should deserialize a string representation into the represented selection state', () => { | ||
expect(deserialize('')).toEqual(undefined); | ||
expect(deserialize(someContextsQueryParam)).toEqual(someSelectionState); | ||
}); | ||
}); |