1+ /* tslint:disable:max-classes-per-file */
2+
13import { expect } from 'chai' ;
24import { createSequelize } from "../../utils/sequelize" ;
35import { Game } from "../../models/exports/Game" ;
46import Gamer from "../../models/exports/gamer.model" ;
57import { Sequelize } from "../../../lib/models/Sequelize" ;
8+ import { Model } from '../../../lib/models/Model' ;
9+ import { Table } from '../../../lib/annotations/Table' ;
610
711describe ( 'sequelize' , ( ) => {
812
@@ -16,6 +20,35 @@ describe('sequelize', () => {
1620
1721 } ) ;
1822
23+ describe ( 'global define options' , ( ) => {
24+
25+ const DEFINE_OPTIONS = { timestamps : true , underscoredAll : true } ;
26+ const sequelizeWithDefine = createSequelize ( false , DEFINE_OPTIONS ) ;
27+
28+ it ( 'should have define options' , ( ) => {
29+ expect ( sequelizeWithDefine )
30+ . to . have . property ( 'options' )
31+ . that . has . property ( 'define' )
32+ . that . eqls ( DEFINE_OPTIONS )
33+ ;
34+ } ) ;
35+
36+ it ( 'should set define options for models' , ( ) => {
37+ @Table
38+ class User extends Model < User > { }
39+ sequelizeWithDefine . addModels ( [ User ] ) ;
40+
41+ Object
42+ . keys ( DEFINE_OPTIONS )
43+ . forEach ( key => {
44+ expect ( User )
45+ . to . have . property ( 'options' )
46+ . that . have . property ( key , DEFINE_OPTIONS [ key ] ) ;
47+ } ) ;
48+ } ) ;
49+
50+ } ) ;
51+
1952 describe ( 'addModels' , ( ) => {
2053
2154 it ( 'should not throw' , ( ) => {
0 commit comments