reload.test.js
1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
'use strict';
const chai = require('chai'),
expect = chai.expect,
Support = require('../support'),
current = Support.sequelize,
Sequelize = Support.Sequelize,
sinon = require('sinon');
describe(Support.getTestDialectTeaser('Instance'), () => {
describe('reload', () => {
describe('options tests', () => {
let stub, instance;
const Model = current.define('User', {
id: {
type: Sequelize.BIGINT,
primaryKey: true,
autoIncrement: true
},
deletedAt: {
type: Sequelize.DATE
}
}, {
paranoid: true
});
before(() => {
stub = sinon.stub(current, 'query').resolves(
{
_previousDataValues: { id: 1 },
dataValues: { id: 2 }
}
);
});
after(() => {
stub.restore();
});
it('should allow reloads even if options are not given', () => {
instance = new Model({ id: 1 }, { isNewRecord: false });
expect(() => {
instance.reload();
}).to.not.throw();
});
});
});
});