forked from sequelize/sequelize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sscce.js
35 lines (23 loc) · 920 Bytes
/
sscce.js
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
'use strict';
/* eslint-disable no-console -- the point of this file is to debug :) */
// See https://github.com/papb/sequelize-sscce as another option for running SSCCEs.
const { expect } = require('chai'); // You can use `expect` on your SSCCE!
const { createSequelizeInstance } = require('./dev/sscce-helpers');
const { Model, DataTypes } = require('.');
const sequelize = createSequelizeInstance({ benchmark: true });
class User extends Model {}
User.init({
username: DataTypes.STRING,
birthday: DataTypes.DATE,
}, { sequelize, modelName: 'user' });
(async () => {
await sequelize.sync({ force: true });
const jane = await User.create({
username: 'janedoe',
birthday: new Date(1980, 6, 20),
});
console.log('\nJane:', jane.toJSON());
await sequelize.close();
expect(jane.username).to.equal('janedoe');
})();
/* eslint-enable no-console -- the point of this file is to debug :) */