Skip to content
This repository was archived by the owner on Aug 1, 2025. It is now read-only.

Commit 7620790

Browse files
committed
Merge branch 'develop'
2 parents 0ea22ab + 2cb4251 commit 7620790

File tree

5 files changed

+80
-40
lines changed

5 files changed

+80
-40
lines changed

package-lock.json

Lines changed: 41 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sequelize-test-helpers",
3-
"version": "1.2.1",
3+
"version": "1.2.2",
44
"description": "A collection of utilities to help with unit-testing sequelize models",
55
"author": "Dave Sag <[email protected]>",
66
"type": "commonjs",
@@ -23,7 +23,7 @@
2323
"test": "test"
2424
},
2525
"scripts": {
26-
"eslint-check": "eslint --print-config .eslintrc.js | eslint-config-prettier-check",
26+
"eslint-check": "eslint --print-config src/index.js | eslint-config-prettier-check",
2727
"lint": "eslint .",
2828
"prettier": "prettier --write '**/*.{js,json,md}'",
2929
"test": "npm run test:unit",
@@ -57,11 +57,11 @@
5757
"chai": "^4.2.0",
5858
"chai-as-promised": "^7.1.1",
5959
"eslint": "^6.8.0",
60-
"eslint-config-prettier": "^6.8.0",
60+
"eslint-config-prettier": "^6.9.0",
6161
"eslint-config-standard": "^14.1.0",
6262
"eslint-plugin-import": "^2.19.1",
6363
"eslint-plugin-mocha": "^6.2.2",
64-
"eslint-plugin-node": "^10.0.0",
64+
"eslint-plugin-node": "^11.0.0",
6565
"eslint-plugin-prettier": "^3.1.2",
6666
"eslint-plugin-promise": "^4.2.1",
6767
"eslint-plugin-standard": "^4.0.1",

src/constants/staticMethods.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
const staticMethods = [
2+
'and',
3+
'cast',
4+
'col',
5+
'fn',
6+
'json',
7+
'literal',
8+
'or',
9+
'useCLS',
10+
'where'
11+
]
12+
13+
module.exports = staticMethods

src/sequelize.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const sinon = require('sinon')
22
const hooks = require('./constants/hooks')
3+
const staticMethods = require('./constants/staticMethods')
34

45
const sequelize = {
56
define: (modelName, modelDefn, metaData = {}) => {
@@ -44,4 +45,8 @@ const sequelize = {
4445
}
4546
}
4647

48+
staticMethods.forEach(method => {
49+
sequelize[method] = sinon.stub()
50+
})
51+
4752
module.exports = sequelize

test/unit/sequelize.test.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
const { expect } = require('chai')
2+
3+
const sequelize = require('../../src/sequelize')
4+
const staticMethods = require('../../src/constants/staticMethods')
5+
6+
describe('src/sequelize', () => {
7+
it('has define', () => {
8+
expect(sequelize).to.have.property('define')
9+
expect(sequelize.define).to.be.a('function')
10+
})
11+
12+
staticMethods.forEach(method => {
13+
it(`has static method ${method}`, () => {
14+
expect(sequelize[method]).to.be.a('function')
15+
})
16+
})
17+
})

0 commit comments

Comments
 (0)