forked from sequelize/sequelize
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sscce.ts
35 lines (27 loc) · 796 Bytes
/
sscce.ts
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
import { expect } from 'chai';
import { Model, DataTypes } from '@sequelize/core';
import { Attribute } from '@sequelize/core/decorators-legacy';
import { createSequelizeInstance } from './dev/sscce-helpers';
class User extends Model {
@Attribute({
type: DataTypes.STRING,
allowNull: false,
})
declare username: string;
@Attribute({
type: DataTypes.DATE,
allowNull: false,
})
declare birthday: Date;
}
const sequelize = createSequelizeInstance({ benchmark: true, models: [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');
})();