1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-18 09:13:33 +00:00

[PM-24796] Ensure the CipherView prototype is not lost within the cache Signal (#16267)

This commit is contained in:
Shane Melton
2025-09-03 09:34:35 -07:00
committed by GitHub
parent 73e8532ecc
commit 2de321d6e8
2 changed files with 7 additions and 4 deletions

View File

@@ -2,6 +2,7 @@ import { signal } from "@angular/core";
import { TestBed } from "@angular/core/testing";
import { ViewCacheService } from "@bitwarden/angular/platform/view-cache";
import { Cipher } from "@bitwarden/common/vault/models/domain/cipher";
import { CipherView } from "@bitwarden/common/vault/models/view/cipher.view";
import { CipherFormCacheService } from "./default-cipher-form-cache.service";
@@ -36,9 +37,10 @@ describe("CipherFormCacheService", () => {
it("updates the signal value", async () => {
service = testBed.inject(CipherFormCacheService);
service.cacheCipherView({ id: "cipher-5" } as CipherView);
service.cacheCipherView(new CipherView({ id: "cipher-5" } as Cipher));
expect(cacheSignal.set).toHaveBeenCalledWith({ id: "cipher-5" });
expect(cacheSignal.set).toHaveBeenCalledWith(expect.any(CipherView)); // Ensure we keep the CipherView prototype
expect(cacheSignal.set).toHaveBeenCalledWith(expect.objectContaining({ id: "cipher-5" }));
});
describe("initializedWithValue", () => {