1
0
mirror of https://github.com/bitwarden/browser synced 2026-01-05 10:03:21 +00:00
Files
browser/libs/common/src/tools/send/services/key-definitions.spec.ts
Tom a6e178f1e6 [PM-5574] sends state provider (#8373)
* Adding the key definitions and tests and initial send state service

* Adding the abstraction and implementing

* Planning comments

* Everything but fixing the send tests

* Moving send tests over to the state provider

* jslib needed name refactor

* removing get/set encrypted sends from web vault state service

* browser send state service factory

* Fixing conflicts

* Removing send service from services module and fixing send service observable

* Commenting the migrator to be clear on why only encrypted

* No need for service factories in browser

* browser send service is no longer needed

* Key def test cases to use toStrictEqual

* Running prettier

* Creating send test data to avoid code duplication

* Adding state provider and account service to send in cli

* Fixing the send service test cases

* Fixing state definition keys

* Moving to observables and implementing encryption service

* Fixing key def tests

* The cli was using the deprecated get method

* The observables init doesn't need to happen in constructor

* Missed commented out code

* If enc key is null get user key

* Service factory fix
2024-04-02 12:39:06 -04:00

22 lines
824 B
TypeScript

import { SEND_USER_ENCRYPTED, SEND_USER_DECRYPTED } from "./key-definitions";
import { testSendData, testSendViewData } from "./test-data/send-tests.data";
describe("Key definitions", () => {
describe("SEND_USER_ENCRYPTED", () => {
it("should pass through deserialization", () => {
const result = SEND_USER_ENCRYPTED.deserializer(
JSON.parse(JSON.stringify(testSendData("1", "Test Send Data"))),
);
expect(result).toEqual(testSendData("1", "Test Send Data"));
});
});
describe("SEND_USER_DECRYPTED", () => {
it("should pass through deserialization", () => {
const sendViews = [testSendViewData("1", "Test Send View")];
const result = SEND_USER_DECRYPTED.deserializer(JSON.parse(JSON.stringify(sendViews)));
expect(result).toEqual(sendViews);
});
});
});