From 94901dafe2604e98ef62e7727d8f12688b08b43d Mon Sep 17 00:00:00 2001 From: scott-wyatt Date: Sun, 24 Mar 2019 09:51:27 -0500 Subject: [PATCH] [fix] schema on resolver --- lib/SequelizeResolver.ts | 3 ++- package-lock.json | 2 +- package.json | 2 +- test/integrations/spool.test.js | 11 ++++++++++- 4 files changed, 14 insertions(+), 4 deletions(-) diff --git a/lib/SequelizeResolver.ts b/lib/SequelizeResolver.ts index 4002a45..fc51861 100644 --- a/lib/SequelizeResolver.ts +++ b/lib/SequelizeResolver.ts @@ -47,7 +47,7 @@ export class SequelizeResolver extends FabrixResolver { /** * Get schema provided to the model when connected */ - get schame() { + get schema() { return this._schema } @@ -61,6 +61,7 @@ export class SequelizeResolver extends FabrixResolver { public connect(modelName, schema, options) { this._options = options + this._schema = schema // Define the Sequelize Connection on the provided connection this._sequelizeModel = this._connection.define(modelName, schema, options) diff --git a/package-lock.json b/package-lock.json index 466739f..f8f0807 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@fabrix/spool-sequelize", - "version": "1.6.7", + "version": "1.6.8", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 51baa04..6e7f653 100755 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@fabrix/spool-sequelize", - "version": "1.6.7", + "version": "1.6.8", "description": "Spool - Datastore Spool for Sequelize.js http://sequelizejs.com", "scripts": { "build": "tsc -p ./lib/tsconfig.release.json", diff --git a/test/integrations/spool.test.js b/test/integrations/spool.test.js index a369823..5ab3788 100755 --- a/test/integrations/spool.test.js +++ b/test/integrations/spool.test.js @@ -154,7 +154,7 @@ describe('Spool', () => { }) }) it('should find an instance by id', (done) => { - const instance = global.app.models.testModel.findById(1) + const instance = global.app.models.testModel.findByPk(1) .then(i => { done() }) @@ -204,6 +204,15 @@ describe('Spool', () => { done() }) + it('should be able to access the options provided', (done) => { + const instance = global.app.models.testModel.resolver.options + done() + }) + it('should be able to access the schema provided', (done) => { + const instance = global.app.models.testModel.resolver.schema + done() + }) + describe('Model Extending', () => { it('should create an instance of an extended model', (done) => { const instance = global.app.models.testModel2.create({name: 'test', name2: 'test'})