문제: Web Storage 어댑터의 실패 원인은 QUOTA_EXCEEDED, SIZE_LIMIT_EXCEEDED, UNAVAILABLE, VALUE_REJECTED 넷이다. 진단 이벤트 storage.operation.failed는 error_kind에 quota면 STORAGE_QUOTA_EXCEEDED, 나머지는 모두 STORAGE_UNAVAILABLE을 넣고 원인을 버린다. 그래서 운영자는 "브라우저 저장소를 못 쓴다"와 "저장된 값이 깨져서 버렸다"를 같은 이벤트로 본다. 호출자에게 주는 실패 code에는 원인이 이미 들어 있다. 고른 방법: recordStorageFailure의 context에 reason: cause를 더한다. reason은 진단 계약의 허용 칸(taxonomy)이고 원인 값은 어댑터의 닫힌 유니온이라 cardinality가 늘지 않는다. projectDiagnosticRecord에 넣어 칸이 그대로 남는 것을 확인했다. 버린 대안: error_kind를 원인별로 나누는 것. error_kind는 createFailure의 error kind taxonomy와 맞춰져 있어, 값을 늘리면 그 taxonomy를 바꿔야 한다. 이미 있는 reason 칸에 싣는 쪽이 추가만으로 끝난다. 위험·한계: 진단 이벤트에 칸이 하나 는다(추가만). 수집기가 reason을 바깥으로 내보내는지는 영역 03 소관이라 보지 않았다. 검증: - RED: storage-registry의 quota, discard 3종(malformed, invalid envelope, oversized), oversize write 테스트 5개가 실패. 예: "expected vi.fn() to be called with arguments" 차이 `- "reason": "VALUE_REJECTED"`. - GREEN: 같은 파일 23/23 통과. - 회귀: storage-registry, runtime-adapters, diagnostics, release-mismatch-recovery 4파일 68/68 통과. tsc app·test 통과, eslint 통과. Refs: docs/reviews/2026-11-01-maturity-review/05-adapters-storage-kernel.md
575 lines
18 KiB
TypeScript
575 lines
18 KiB
TypeScript
import { describe, expect, it, vi } from "vitest";
|
|
|
|
import { createBrowserStorageAdapter } from "../../src/adapters/storage/browser-storage-adapter.ts";
|
|
import {
|
|
STORAGE_REGISTRY,
|
|
buildPhysicalKey,
|
|
defineStorageKey,
|
|
getStorageDefinition,
|
|
isStorageValueAllowed,
|
|
type StorageDefinition,
|
|
type StorageKeyInput,
|
|
} from "../../src/contracts/storage-keys.ts";
|
|
|
|
type StorageFailureMode = "none" | "quota" | "security";
|
|
|
|
function createStorage(options: {
|
|
initial?: Readonly<Record<string, string>>;
|
|
writeFailure?: StorageFailureMode;
|
|
readFailure?: StorageFailureMode;
|
|
removeFailure?: StorageFailureMode;
|
|
} = {}) {
|
|
const values = new Map<string, string>(Object.entries(options.initial ?? {}));
|
|
const state = {
|
|
writeFailure: options.writeFailure ?? "none",
|
|
readFailure: options.readFailure ?? "none",
|
|
removeFailure: options.removeFailure ?? "none",
|
|
};
|
|
const getItem = vi.fn((key: string) => {
|
|
throwFor(state.readFailure);
|
|
return values.get(key) ?? null;
|
|
});
|
|
const setItem = vi.fn((key: string, value: string) => {
|
|
throwFor(state.writeFailure);
|
|
values.set(key, value);
|
|
});
|
|
const removeItem = vi.fn((key: string) => {
|
|
throwFor(state.removeFailure);
|
|
values.delete(key);
|
|
});
|
|
const storage: Storage = {
|
|
getItem,
|
|
setItem,
|
|
removeItem,
|
|
clear: () => values.clear(),
|
|
key: (index) => [...values.keys()][index] ?? null,
|
|
get length() {
|
|
return values.size;
|
|
},
|
|
};
|
|
return { storage, values, state, getItem, setItem, removeItem };
|
|
}
|
|
|
|
function throwFor(mode: StorageFailureMode): void {
|
|
if (mode === "quota") {
|
|
throw new DOMException("private quota detail", "QuotaExceededError");
|
|
}
|
|
if (mode === "security") {
|
|
throw new DOMException("private security detail", "SecurityError");
|
|
}
|
|
}
|
|
|
|
function serializedEnvelope(
|
|
value: unknown,
|
|
overrides: Readonly<{
|
|
schemaVersion?: number;
|
|
expiresAt?: number | null;
|
|
}> = {},
|
|
): string {
|
|
return JSON.stringify({
|
|
schemaVersion: overrides.schemaVersion ?? 1,
|
|
expiresAt: overrides.expiresAt ?? null,
|
|
value,
|
|
});
|
|
}
|
|
|
|
function definitionResolver(
|
|
extra: Readonly<Record<string, StorageDefinition>>,
|
|
) {
|
|
return (logicalName: string): StorageDefinition =>
|
|
extra[logicalName] ?? getStorageDefinition(logicalName);
|
|
}
|
|
|
|
describe("storage registry", () => {
|
|
it("builds namespace and schema-versioned physical keys", () => {
|
|
expect(buildPhysicalKey("preference", 2, "theme")).toBe(
|
|
"ca-frontend:preference:v2:theme",
|
|
);
|
|
expect(STORAGE_REGISTRY.COLOR_SCHEME.physicalKey).toContain(":v1:");
|
|
});
|
|
|
|
it("rejects token or secret persistence registrations", () => {
|
|
expect(() =>
|
|
defineStorageKey({
|
|
logicalName: "TOKEN",
|
|
scope: "auth",
|
|
name: "token",
|
|
backend: "localStorage",
|
|
classification: "sensitive-forbidden",
|
|
schemaVersion: 1,
|
|
valueCodec: "none",
|
|
ttl: null,
|
|
migration: "discard",
|
|
quotaFallback: "feature-disable",
|
|
}),
|
|
).toThrow("Sensitive client storage registration is forbidden");
|
|
});
|
|
|
|
it("enforces the registry-owned typed value codec contract", () => {
|
|
const colorScheme = STORAGE_REGISTRY.COLOR_SCHEME;
|
|
expect(
|
|
["system", "light", "dark"].every((value) =>
|
|
isStorageValueAllowed(colorScheme, value),
|
|
),
|
|
).toBe(true);
|
|
expect(
|
|
[
|
|
"",
|
|
"LIGHT",
|
|
"private-custom-theme",
|
|
1,
|
|
null,
|
|
{ mode: "dark" },
|
|
].some((value) => isStorageValueAllowed(colorScheme, value)),
|
|
).toBe(false);
|
|
|
|
const opaqueString = STORAGE_REGISTRY.CHUNK_RELOAD_GUARD;
|
|
expect(isStorageValueAllowed(opaqueString, "a")).toBe(true);
|
|
expect(isStorageValueAllowed(opaqueString, "x".repeat(2_048))).toBe(true);
|
|
expect(isStorageValueAllowed(opaqueString, "")).toBe(false);
|
|
expect(isStorageValueAllowed(opaqueString, "x".repeat(2_049))).toBe(false);
|
|
expect(isStorageValueAllowed(opaqueString, { value: "opaque" })).toBe(false);
|
|
|
|
expect(
|
|
isStorageValueAllowed(
|
|
STORAGE_REGISTRY.QUERY_PERSISTENCE,
|
|
"must-never-persist",
|
|
),
|
|
).toBe(false);
|
|
});
|
|
|
|
it("rejects unregistered codecs and executable migration policies", () => {
|
|
const definition = {
|
|
logicalName: "UNSAFE_POLICY",
|
|
scope: "preference",
|
|
name: "unsafe-policy",
|
|
backend: "localStorage",
|
|
classification: "public-preference",
|
|
schemaVersion: 1,
|
|
valueCodec: "unregistered-codec",
|
|
ttl: null,
|
|
migration: "discard",
|
|
quotaFallback: "no-persist",
|
|
} as unknown as StorageKeyInput;
|
|
expect(() => defineStorageKey(definition)).toThrow(
|
|
"Unknown client storage value codec",
|
|
);
|
|
|
|
expect(() =>
|
|
defineStorageKey({
|
|
...definition,
|
|
valueCodec: "opaque-string-v1",
|
|
migration: (() => "unsafe") as unknown as "discard",
|
|
}),
|
|
).toThrow("Unsupported client storage migration policy");
|
|
});
|
|
|
|
// 05-01. The cross-context adapter writes raw wire JSON to this physical
|
|
// key. StoragePort must refuse the key instead of discarding that value as
|
|
// a corrupt envelope or overwriting it with one.
|
|
it("refuses the externally owned pulse key without touching its value", () => {
|
|
const pulse = STORAGE_REGISTRY.CACHE_INVALIDATION_PULSE;
|
|
const rawPulse = JSON.stringify({ protocolVersion: 1, topic: "t" });
|
|
const { storage, values, setItem, removeItem } = createStorage({
|
|
initial: { [pulse.physicalKey]: rawPulse },
|
|
});
|
|
const adapter = createBrowserStorageAdapter({ localStorage: storage });
|
|
|
|
expect(adapter.read("CACHE_INVALIDATION_PULSE")).toMatchObject({
|
|
ok: false,
|
|
error: { code: "CACHE_INVALIDATION_PULSE_READ_UNAVAILABLE" },
|
|
});
|
|
expect(adapter.write("CACHE_INVALIDATION_PULSE", "hello")).toMatchObject({
|
|
ok: false,
|
|
});
|
|
expect(adapter.remove("CACHE_INVALIDATION_PULSE")).toMatchObject({
|
|
ok: false,
|
|
});
|
|
expect(setItem).not.toHaveBeenCalled();
|
|
expect(removeItem).not.toHaveBeenCalled();
|
|
expect(values.get(pulse.physicalKey)).toBe(rawPulse);
|
|
|
|
expect(pulse.physicalKey).toBe("ca-frontend:cache-invalidation:v1:pulse");
|
|
expect(pulse).toMatchObject({ backend: "external", valueCodec: "none" });
|
|
expect(() => getStorageDefinition("CACHE_INVALIDATION_PULSE")).toThrow(
|
|
"Externally owned storage key: CACHE_INVALIDATION_PULSE",
|
|
);
|
|
});
|
|
|
|
it("rejects a value codec on an externally owned key", () => {
|
|
expect(() =>
|
|
defineStorageKey({
|
|
logicalName: "EXTERNAL_WITH_CODEC",
|
|
scope: "cache",
|
|
name: "external-with-codec",
|
|
backend: "external",
|
|
classification: "opaque-cache",
|
|
schemaVersion: 1,
|
|
valueCodec: "opaque-string-v1",
|
|
ttl: null,
|
|
migration: "discard",
|
|
quotaFallback: "no-persist",
|
|
}),
|
|
).toThrow("Externally owned storage keys have no StoragePort codec");
|
|
});
|
|
|
|
it("round-trips public preferences through the adapter", () => {
|
|
const { storage: localStorage } = createStorage();
|
|
const adapter = createBrowserStorageAdapter({ localStorage });
|
|
expect(adapter.write("COLOR_SCHEME", "dark")).toEqual({ ok: true });
|
|
expect(adapter.read("COLOR_SCHEME")).toEqual({ ok: true, value: "dark" });
|
|
});
|
|
|
|
it("keeps local and session registry entries on their declared backends", () => {
|
|
const local = createStorage();
|
|
const session = createStorage();
|
|
const adapter = createBrowserStorageAdapter({
|
|
localStorage: local.storage,
|
|
sessionStorage: session.storage,
|
|
});
|
|
|
|
expect(adapter.write("COLOR_SCHEME", "light")).toEqual({ ok: true });
|
|
expect(adapter.write("CHUNK_RELOAD_GUARD", "release-a->release-b")).toEqual({
|
|
ok: true,
|
|
});
|
|
expect(
|
|
local.values.has(STORAGE_REGISTRY.COLOR_SCHEME.physicalKey),
|
|
).toBe(true);
|
|
expect(
|
|
local.values.has(STORAGE_REGISTRY.CHUNK_RELOAD_GUARD.physicalKey),
|
|
).toBe(false);
|
|
expect(
|
|
session.values.has(STORAGE_REGISTRY.CHUNK_RELOAD_GUARD.physicalKey),
|
|
).toBe(true);
|
|
expect(adapter.read("CHUNK_RELOAD_GUARD")).toEqual({
|
|
ok: true,
|
|
value: "release-a->release-b",
|
|
});
|
|
});
|
|
|
|
it("falls back to memory when preference storage quota is exceeded", () => {
|
|
const { storage: localStorage } = createStorage({
|
|
writeFailure: "quota",
|
|
});
|
|
const record = vi.fn();
|
|
const adapter = createBrowserStorageAdapter({
|
|
localStorage,
|
|
diagnostics: { record },
|
|
});
|
|
expect(adapter.write("COLOR_SCHEME", "dark")).toMatchObject({
|
|
ok: false,
|
|
fallback: "memory",
|
|
error: { kind: "STORAGE_QUOTA_EXCEEDED" },
|
|
});
|
|
expect(adapter.read("COLOR_SCHEME")).toEqual({ ok: true, value: "dark" });
|
|
expect(record).toHaveBeenCalledOnce();
|
|
expect(record).toHaveBeenCalledWith({
|
|
level: "warn",
|
|
eventId: "storage.operation.failed",
|
|
context: {
|
|
operation: "write:COLOR_SCHEME",
|
|
error_kind: "STORAGE_QUOTA_EXCEEDED",
|
|
reason: "QUOTA_EXCEEDED",
|
|
},
|
|
});
|
|
expect(JSON.stringify(record.mock.calls)).not.toContain("dark");
|
|
expect(JSON.stringify(record.mock.calls)).not.toContain(
|
|
"private quota detail",
|
|
);
|
|
});
|
|
|
|
it("discards data from a previous schema version", () => {
|
|
const { storage: localStorage, values, removeItem } = createStorage({
|
|
initial: {
|
|
[STORAGE_REGISTRY.COLOR_SCHEME.physicalKey]: serializedEnvelope(
|
|
"dark",
|
|
{ schemaVersion: 2 },
|
|
),
|
|
},
|
|
});
|
|
const adapter = createBrowserStorageAdapter({ localStorage });
|
|
expect(adapter.read("COLOR_SCHEME")).toEqual({ ok: true, value: undefined });
|
|
expect(removeItem).toHaveBeenCalledOnce();
|
|
expect(values.has(STORAGE_REGISTRY.COLOR_SCHEME.physicalKey)).toBe(false);
|
|
});
|
|
|
|
it("rejects values outside the selected key codec before persistence", () => {
|
|
const { storage: localStorage, setItem } = createStorage();
|
|
const adapter = createBrowserStorageAdapter({ localStorage });
|
|
|
|
expect(adapter.write("COLOR_SCHEME", { mode: "dark" })).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
kind: "STORAGE_UNAVAILABLE",
|
|
code: "COLOR_SCHEME_WRITE_VALUE_REJECTED",
|
|
},
|
|
});
|
|
expect(setItem).not.toHaveBeenCalled();
|
|
});
|
|
|
|
it.each([
|
|
["malformed JSON", "{private malformed value", "VALUE_REJECTED"],
|
|
[
|
|
"invalid envelope",
|
|
JSON.stringify({
|
|
schemaVersion: 1,
|
|
expiresAt: null,
|
|
value: "dark",
|
|
unexpected: "private",
|
|
}),
|
|
"VALUE_REJECTED",
|
|
],
|
|
["oversized record", "x".repeat(512), "SIZE_LIMIT_EXCEEDED"],
|
|
])(
|
|
"removes a %s once and suppresses it when native cleanup fails",
|
|
(_label, raw, reason) => {
|
|
const physicalKey = STORAGE_REGISTRY.COLOR_SCHEME.physicalKey;
|
|
const { storage, getItem, removeItem } = createStorage({
|
|
initial: { [physicalKey]: raw },
|
|
removeFailure: "security",
|
|
});
|
|
const record = vi.fn();
|
|
const adapter = createBrowserStorageAdapter({
|
|
localStorage: storage,
|
|
diagnostics: { record },
|
|
maxSerializedBytes: 128,
|
|
});
|
|
|
|
expect(adapter.read("COLOR_SCHEME")).toEqual({
|
|
ok: true,
|
|
value: undefined,
|
|
});
|
|
expect(adapter.read("COLOR_SCHEME")).toEqual({
|
|
ok: true,
|
|
value: undefined,
|
|
});
|
|
expect(getItem).toHaveBeenCalledOnce();
|
|
expect(removeItem).toHaveBeenCalledOnce();
|
|
// 05-02. A discarded value must not read as "storage unavailable".
|
|
expect(record).toHaveBeenCalledWith({
|
|
level: "warn",
|
|
eventId: "storage.operation.failed",
|
|
context: {
|
|
operation: "discard:COLOR_SCHEME",
|
|
error_kind: "STORAGE_UNAVAILABLE",
|
|
reason,
|
|
},
|
|
});
|
|
expect(JSON.stringify(record.mock.calls)).not.toMatch(
|
|
/private|malformed|unexpected/,
|
|
);
|
|
},
|
|
);
|
|
|
|
it("removes expired persistent records and does not return their value", () => {
|
|
const expiring = defineStorageKey({
|
|
logicalName: "EXPIRING_PREFERENCE",
|
|
scope: "preference",
|
|
name: "expiring",
|
|
backend: "localStorage",
|
|
classification: "public-preference",
|
|
schemaVersion: 1,
|
|
valueCodec: "opaque-string-v1",
|
|
ttl: 10,
|
|
migration: "discard",
|
|
quotaFallback: "memory",
|
|
});
|
|
const { storage, removeItem } = createStorage({
|
|
initial: {
|
|
[expiring.physicalKey]: serializedEnvelope("private-expired", {
|
|
expiresAt: 99,
|
|
}),
|
|
},
|
|
});
|
|
const adapter = createBrowserStorageAdapter({
|
|
localStorage: storage,
|
|
now: () => 100,
|
|
resolveDefinition: definitionResolver({
|
|
EXPIRING_PREFERENCE: expiring,
|
|
}),
|
|
});
|
|
|
|
expect(adapter.read("EXPIRING_PREFERENCE")).toEqual({
|
|
ok: true,
|
|
value: undefined,
|
|
});
|
|
expect(removeItem).toHaveBeenCalledWith(expiring.physicalKey);
|
|
});
|
|
|
|
it("prioritizes a failed-write memory envelope over stale persistent data and expires it", () => {
|
|
let timestamp = 100;
|
|
const expiring = defineStorageKey({
|
|
logicalName: "EXPIRING_PREFERENCE",
|
|
scope: "preference",
|
|
name: "expiring",
|
|
backend: "localStorage",
|
|
classification: "public-preference",
|
|
schemaVersion: 1,
|
|
valueCodec: "opaque-string-v1",
|
|
ttl: 10,
|
|
migration: "discard",
|
|
quotaFallback: "memory",
|
|
});
|
|
const { storage, state } = createStorage({
|
|
initial: {
|
|
[expiring.physicalKey]: serializedEnvelope("stale", {
|
|
expiresAt: 1_000,
|
|
}),
|
|
},
|
|
writeFailure: "quota",
|
|
});
|
|
const adapter = createBrowserStorageAdapter({
|
|
localStorage: storage,
|
|
now: () => timestamp,
|
|
resolveDefinition: definitionResolver({
|
|
EXPIRING_PREFERENCE: expiring,
|
|
}),
|
|
});
|
|
|
|
expect(adapter.write("EXPIRING_PREFERENCE", "fresh")).toMatchObject({
|
|
ok: false,
|
|
fallback: "memory",
|
|
});
|
|
expect(adapter.read("EXPIRING_PREFERENCE")).toEqual({
|
|
ok: true,
|
|
value: "fresh",
|
|
});
|
|
|
|
state.writeFailure = "none";
|
|
timestamp = 111;
|
|
expect(adapter.read("EXPIRING_PREFERENCE")).toEqual({
|
|
ok: true,
|
|
value: undefined,
|
|
});
|
|
});
|
|
|
|
it("clears a failed-write overlay after a later persistent write succeeds", () => {
|
|
const physicalKey = STORAGE_REGISTRY.COLOR_SCHEME.physicalKey;
|
|
const { storage, state, values } = createStorage({
|
|
writeFailure: "security",
|
|
});
|
|
const adapter = createBrowserStorageAdapter({ localStorage: storage });
|
|
|
|
expect(adapter.write("COLOR_SCHEME", "dark")).toMatchObject({
|
|
ok: false,
|
|
fallback: "memory",
|
|
error: { kind: "STORAGE_UNAVAILABLE" },
|
|
});
|
|
expect(adapter.read("COLOR_SCHEME")).toEqual({
|
|
ok: true,
|
|
value: "dark",
|
|
});
|
|
|
|
state.writeFailure = "none";
|
|
expect(adapter.write("COLOR_SCHEME", "light")).toEqual({ ok: true });
|
|
values.set(physicalKey, serializedEnvelope("system"));
|
|
expect(adapter.read("COLOR_SCHEME")).toEqual({
|
|
ok: true,
|
|
value: "system",
|
|
});
|
|
});
|
|
|
|
it("purges the memory overlay even when persistent remove throws", () => {
|
|
const { storage, state } = createStorage({
|
|
writeFailure: "quota",
|
|
removeFailure: "security",
|
|
});
|
|
const adapter = createBrowserStorageAdapter({ localStorage: storage });
|
|
expect(adapter.write("COLOR_SCHEME", "dark")).toMatchObject({
|
|
fallback: "memory",
|
|
});
|
|
|
|
state.writeFailure = "none";
|
|
expect(adapter.remove("COLOR_SCHEME")).toMatchObject({
|
|
ok: false,
|
|
error: { kind: "STORAGE_UNAVAILABLE" },
|
|
});
|
|
expect(adapter.read("COLOR_SCHEME")).toEqual({
|
|
ok: true,
|
|
value: undefined,
|
|
});
|
|
});
|
|
|
|
it("normalizes SecurityError reads and never exposes native details", () => {
|
|
const { storage } = createStorage({ readFailure: "security" });
|
|
const record = vi.fn();
|
|
const adapter = createBrowserStorageAdapter({
|
|
localStorage: storage,
|
|
diagnostics: { record },
|
|
});
|
|
|
|
const result = adapter.read("COLOR_SCHEME");
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
kind: "STORAGE_UNAVAILABLE",
|
|
code: "COLOR_SCHEME_READ_UNAVAILABLE",
|
|
},
|
|
});
|
|
expect(JSON.stringify({ result, calls: record.mock.calls })).not.toContain(
|
|
"private security detail",
|
|
);
|
|
});
|
|
|
|
it.each([
|
|
["cyclic", (() => {
|
|
const value: { self?: unknown; secret: string } = {
|
|
secret: "private-cyclic",
|
|
};
|
|
value.self = value;
|
|
return value;
|
|
})()],
|
|
["BigInt", { secret: "private-bigint", value: 1n }],
|
|
["exotic", new Date(0)],
|
|
])("rejects %s values before calling the backend", (_label, value) => {
|
|
const { storage, setItem } = createStorage();
|
|
const record = vi.fn();
|
|
const adapter = createBrowserStorageAdapter({
|
|
localStorage: storage,
|
|
diagnostics: { record },
|
|
});
|
|
|
|
const result = adapter.write("COLOR_SCHEME", value);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
kind: "STORAGE_UNAVAILABLE",
|
|
code: "COLOR_SCHEME_WRITE_VALUE_REJECTED",
|
|
},
|
|
});
|
|
expect(setItem).not.toHaveBeenCalled();
|
|
expect(JSON.stringify({ result, calls: record.mock.calls })).not.toMatch(
|
|
/private-cyclic|private-bigint/,
|
|
);
|
|
});
|
|
|
|
it("rejects oversized serialized values before persistence and redacts them", () => {
|
|
const secret = `private-oversize-${"x".repeat(512)}`;
|
|
const { storage, setItem } = createStorage();
|
|
const record = vi.fn();
|
|
const adapter = createBrowserStorageAdapter({
|
|
sessionStorage: storage,
|
|
diagnostics: { record },
|
|
maxSerializedBytes: 128,
|
|
});
|
|
|
|
const result = adapter.write("CHUNK_RELOAD_GUARD", secret);
|
|
expect(result).toMatchObject({
|
|
ok: false,
|
|
error: {
|
|
kind: "STORAGE_UNAVAILABLE",
|
|
code: "CHUNK_RELOAD_GUARD_WRITE_SIZE_LIMIT_EXCEEDED",
|
|
},
|
|
});
|
|
expect(record).toHaveBeenCalledWith(
|
|
expect.objectContaining({
|
|
context: expect.objectContaining({ reason: "SIZE_LIMIT_EXCEEDED" }),
|
|
}),
|
|
);
|
|
expect(setItem).not.toHaveBeenCalled();
|
|
expect(JSON.stringify({ result, calls: record.mock.calls })).not.toContain(
|
|
secret,
|
|
);
|
|
});
|
|
});
|