File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -900,6 +900,36 @@ describe('model', () => {
900
900
expect ( u . username ) . to . equal ( 'A fancy name' ) ;
901
901
} ) ;
902
902
} ) ;
903
+
904
+ it ( 'should filter based on the where clause even if IFindOptions.include is []' , ( ) => {
905
+ @Table ( { paranoid : true , timestamps : true } )
906
+ class User extends Model < User > {
907
+
908
+ @Column
909
+ username : string ;
910
+ }
911
+ sequelize . addModels ( [ User ] ) ;
912
+
913
+ return User . sync ( { force : true } )
914
+ . then ( ( ) => {
915
+ return User . create ( { username : 'a1' } ) ;
916
+ } )
917
+ . then ( ( ) => {
918
+ return User . create ( { username : 'a2' } ) ;
919
+ } )
920
+ . then ( ( ) => {
921
+ return User . findOne < User > ( { where : { username : 'a2' } , include : [ ] } ) ;
922
+ } )
923
+ . then ( ( u ) => {
924
+ expect ( u . username ) . to . equal ( 'a2' ) ;
925
+ } )
926
+ . then ( ( ) => {
927
+ return User . findOne < User > ( { where : { username : 'a1' } , include : [ ] } ) ;
928
+ } )
929
+ . then ( ( u ) => {
930
+ expect ( u . username ) . to . equal ( 'a1' ) ;
931
+ } )
932
+ } ) ;
903
933
} ) ;
904
934
905
935
describe ( 'findOrInitialize' , ( ) => {
You can’t perform that action at this time.
0 commit comments