mirror of
https://github.com/bitwarden/browser
synced 2025-12-16 08:13:42 +00:00
* refactor: introduce @bitwarden/serialization * refactor: introduce @bitwarden/guid * refactor: introduce @bitwaren/client-type * refactor: introduce @bitwarden/core-test-utils * refactor: introduce @bitwarden/state and @bitwarden/state-test-utils Creates initial project structure for centralized application state management. Part of modularization effort to extract state code from common. * Added state provider documentation to README. * Changed callouts to Github format. * Fixed linting on file name. * Forced git to accept rename --------- Co-authored-by: Todd Martin <tmartin@bitwarden.com>
26 lines
698 B
TypeScript
26 lines
698 B
TypeScript
import { record } from "@bitwarden/serialization/deserialization-helpers";
|
|
|
|
describe("deserialization helpers", () => {
|
|
describe("record", () => {
|
|
it("deserializes a record when keys are strings", () => {
|
|
const deserializer = record((value: number) => value);
|
|
const input = {
|
|
a: 1,
|
|
b: 2,
|
|
};
|
|
const output = deserializer(input);
|
|
expect(output).toEqual(input);
|
|
});
|
|
|
|
it("deserializes a record when keys are numbers", () => {
|
|
const deserializer = record((value: number) => value);
|
|
const input = {
|
|
1: 1,
|
|
2: 2,
|
|
};
|
|
const output = deserializer(input);
|
|
expect(output).toEqual(input);
|
|
});
|
|
});
|
|
});
|