From 77e14dd3f4a29adff8beb805d0e6186ead59e4fe Mon Sep 17 00:00:00 2001 From: hugo-bach <47207318+hugo-bach@users.noreply.github.com> Date: Tue, 7 Feb 2023 19:43:47 +0100 Subject: [PATCH] fix(knex): The method getModel in the knex adapter (#3043) --- packages/knex/src/adapter.ts | 2 +- packages/knex/test/overrides.test.ts | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/knex/src/adapter.ts b/packages/knex/src/adapter.ts index 65100c5e8b..05b5d72d3e 100644 --- a/packages/knex/src/adapter.ts +++ b/packages/knex/src/adapter.ts @@ -63,7 +63,7 @@ export class KnexAdapter< return this.getModel() } - getModel(params?: ServiceParams) { + getModel(params: ServiceParams = {} as ServiceParams) { const { Model } = this.getOptions(params) return Model } diff --git a/packages/knex/test/overrides.test.ts b/packages/knex/test/overrides.test.ts index 4adb51b862..dcd0f1fad5 100644 --- a/packages/knex/test/overrides.test.ts +++ b/packages/knex/test/overrides.test.ts @@ -122,4 +122,11 @@ describe('Feathers Knex Overridden Method With Self-Join', () => { assert.strictEqual(patchedAnimal.name, newName) }) + + it('get the service model (getModel)', async () => { + const model = animalService.Model + const options = animalService.options + + assert.strictEqual(model, options.Model) + }) })