History

Document WorkOS Vault test error boundary

Rhys Sullivan committed 6 months ago

Commit fdb0bcc1 parent b039b6e1 file · +9 −0Browse files

Unified · Split

packages/plugins/workos-vault/src/sdk/secret-store.test.ts+9−0
@@ -100,9 +100,11 @@ const makeFakeClient = (options?: { · 99 unmodified lines
100100 readonly context: Record<string, string>;
101101 }) => {
102102 if (options?.rejectNamesWithColon && name.includes(":")) {
103+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
103104 throw new FakeInvalidRequestError(`Invalid object name "${name}"`);
104105 }
105106 if (objects.has(name)) {
107+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
106108 throw new FakeConflictError(`Object "${name}" already exists`);
107109 }
108110 const id = nextId();
@@ -113,15 +115,18 @@ const makeFakeClient = (options?: { · 4 unmodified lines
113115
114116 readObjectByName: async (name: string) => {
115117 if (options?.rejectNamesWithColon && name.includes(":")) {
118+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
116119 throw new FakeInvalidRequestError(`Invalid object name "${name}"`);
117120 }
118121 if (
119122 options?.rejectReadNamesLongerThan !== undefined &&
120123 name.length > options.rejectReadNamesLongerThan
121124 ) {
125+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
122126 throw new FakeInvalidRequestError(`Invalid object name "${name}"`);
123127 }
124128 const object = objects.get(name);
129+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
125130 if (!object) throw new FakeNotFoundError(`Object "${name}" not found`);
126131 return object;
127132 },
@@ -136,15 +141,18 @@ const makeFakeClient = (options?: { · 8 unmodified lines
136141 readonly versionCheck?: string;
137142 }) => {
138143 const current = [...objects.values()].find((o) => o.id === id);
144+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
139145 if (!current) throw new FakeNotFoundError(`Object "${id}" not found`);
140146 if (
141147 conflictPending &&
142148 current.name.endsWith("/secrets/conflict")
143149 ) {
144150 conflictPending = false;
151+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
145152 throw new FakeConflictError(`Injected conflict for "${id}"`);
146153 }
147154 if (versionCheck && current.metadata.versionId !== versionCheck) {
155+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
148156 throw new FakeConflictError(`Version mismatch for "${id}"`);
149157 }
150158 const nextVersion = current.metadata.versionId.replace(
@@ -166,6 +174,7 @@ const makeFakeClient = (options?: { · 15 unmodified lines
166174
167175 deleteObject: async ({ id }: { readonly id: string }) => {
168176 const entry = [...objects.entries()].find(([, o]) => o.id === id);
177+ // oxlint-disable-next-line executor/no-try-catch-or-throw -- boundary: fake WorkOS SDK promise rejects with status-shaped errors
169178 if (!entry) throw new FakeNotFoundError(`Object "${id}" not found`);
170179 objects.delete(entry[0]);
171180 },