This repository has been archived by the owner on Feb 6, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: Simple unit tests for the DraftStringKey module Reviewed By: j-nolan Differential Revision: D15063748 fbshipit-source-id: f857332ed835cd3d79c2d68dc8ca133885d4a5ec
- Loading branch information
1 parent
76e121e
commit 978ad6b
Showing
2 changed files
with
26 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/** | ||
* Copyright (c) Facebook, Inc. and its affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
* | ||
* @emails oncall+draft_js | ||
* @flow strict-local | ||
* @format | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const {stringify, unstringify} = require('DraftStringKey'); | ||
|
||
test('must convert maybe strings to a string key', () => { | ||
expect(stringify('anything')).toEqual('_anything'); | ||
expect(stringify(null)).toEqual('_null'); | ||
}); | ||
|
||
test('must convert string keys back to a string', () => { | ||
expect(unstringify('_anything')).toEqual('anything'); | ||
// This is a lossy conversion | ||
expect(unstringify('_null')).toEqual('null'); | ||
}); |