diff --git a/packages/adapter-tests/src/declarations.ts b/packages/adapter-tests/src/declarations.ts index 3268d46fed..1674ced7bd 100644 --- a/packages/adapter-tests/src/declarations.ts +++ b/packages/adapter-tests/src/declarations.ts @@ -28,11 +28,14 @@ export type AdapterMethodsTestName = | '.get + $select' | '.get + id + query' | '.get + NotFound' + | '.get + NotFound (integer)' | '.get + id + query id' | '.find' | '.remove' | '.remove + $select' | '.remove + id + query' + | '.remove + NotFound' + | '.remove + NotFound (integer)' | '.remove + multi' | '.remove + multi no pagination' | '.remove + id + query id' @@ -40,6 +43,7 @@ export type AdapterMethodsTestName = | '.update + $select' | '.update + id + query' | '.update + NotFound' + | '.update + NotFound (integer)' | '.update + query + NotFound' | '.update + id + query id' | '.patch' @@ -50,6 +54,7 @@ export type AdapterMethodsTestName = | '.patch multi query same' | '.patch multi query changed' | '.patch + NotFound' + | '.patch + NotFound (integer)' | '.patch + query + NotFound' | '.patch + id + query id' | '.create' diff --git a/packages/adapter-tests/src/methods.ts b/packages/adapter-tests/src/methods.ts index 271066df40..84d6c3f18f 100644 --- a/packages/adapter-tests/src/methods.ts +++ b/packages/adapter-tests/src/methods.ts @@ -59,6 +59,15 @@ export default (test: AdapterMethodsTest, app: any, _errors: any, serviceName: s } }) + test('.get + NotFound (integer)', async () => { + try { + await service.get(123456789) + throw new Error('Should never get here') + } catch (error: any) { + assert.strictEqual(error.name, 'NotFound', 'Error is a NotFound Feathers error') + } + }) + test('.get + id + query id', async () => { const alice = await service.create({ name: 'Alice', @@ -115,6 +124,24 @@ export default (test: AdapterMethodsTest, app: any, _errors: any, serviceName: s } }) + test('.remove + NotFound', async () => { + try { + await service.remove('568225fbfe21222432e836ff') + throw new Error('Should never get here') + } catch (error: any) { + assert.strictEqual(error.name, 'NotFound', 'Error is a NotFound Feathers error') + } + }) + + test('.remove + NotFound (integer)', async () => { + try { + await service.remove(123456789) + throw new Error('Should never get here') + } catch (error: any) { + assert.strictEqual(error.name, 'NotFound', 'Error is a NotFound Feathers error') + } + }) + test('.remove + multi', async () => { try { await service.remove(null) @@ -278,6 +305,17 @@ export default (test: AdapterMethodsTest, app: any, _errors: any, serviceName: s } }) + test('.update + NotFound (integer)', async () => { + try { + await service.update(123456789, { + name: 'NotFound' + }) + throw new Error('Should never get here') + } catch (error: any) { + assert.strictEqual(error.name, 'NotFound', 'Error is a NotFound Feathers error') + } + }) + test('.update + query + NotFound', async () => { const dave = await service.create({ name: 'Dave' }) try { @@ -541,6 +579,17 @@ export default (test: AdapterMethodsTest, app: any, _errors: any, serviceName: s } }) + test('.patch + NotFound (integer)', async () => { + try { + await service.patch(123456789, { + name: 'PatchDoug' + }) + throw new Error('Should never get here') + } catch (error: any) { + assert.strictEqual(error.name, 'NotFound', 'Error is a NotFound Feathers error') + } + }) + test('.patch + query + NotFound', async () => { const dave = await service.create({ name: 'Dave' }) try {