mirror of
https://github.com/react/react-native-devtools-frontend.git
synced 2026-10-02 18:11:04 +08:00
[Unittest] Add unit tests to UIString
Bug: 1009443 Change-Id: I4f82d785e5d2f6ab2b2d3a6b4e735961ff906c0e Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2046554 Reviewed-by: Paul Lewis <aerotwist@chromium.org> Commit-Queue: Jack Franklin <jacktfranklin@chromium.org>
This commit is contained in:
committed by
Commit Bot
parent
26a68eeffc
commit
c05ee8a3ff
@@ -14,4 +14,27 @@ describe('UIString', () => {
|
||||
values: [],
|
||||
}));
|
||||
});
|
||||
|
||||
it('serializes UI strings and includes any values', () => {
|
||||
const output = Common.UIString.serializeUIString('a string', ['value1', 'value2']);
|
||||
assert.equal(output, JSON.stringify({
|
||||
messageParts: ['a string'],
|
||||
values: ['value1', 'value2'],
|
||||
}));
|
||||
});
|
||||
|
||||
it('deserializes UI strings', () => {
|
||||
const inputString = 'a string';
|
||||
const serializedString = Common.UIString.serializeUIString(inputString);
|
||||
const deserializedString = Common.UIString.deserializeUIString(serializedString);
|
||||
assert.deepEqual(deserializedString, {
|
||||
messageParts: [inputString],
|
||||
values: [],
|
||||
});
|
||||
});
|
||||
|
||||
it('returns an empty object if no string is given to deserialize', () => {
|
||||
const output = Common.UIString.deserializeUIString();
|
||||
assert.deepEqual(output, {});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user