Skip to content

Commit

Permalink
Merge pull request #37 from fabrix-app/v1.6
Browse files Browse the repository at this point in the history
[fix] schema on resolver
  • Loading branch information
scott-wyatt authored Mar 24, 2019
2 parents 3b035c6 + 94901da commit 0304769
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
3 changes: 2 additions & 1 deletion lib/SequelizeResolver.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export class SequelizeResolver extends FabrixResolver {
/**
* Get schema provided to the model when connected
*/
get schame() {
get schema() {
return this._schema
}

Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
11 changes: 10 additions & 1 deletion test/integrations/spool.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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()
})
Expand Down Expand Up @@ -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'})
Expand Down

0 comments on commit 0304769

Please sign in to comment.