@@ -38,12 +38,12 @@ describe('isDSModel', () => {
38
38
} ) ;
39
39
40
40
describe ( "should check if it's a DS Model even if it uses custom name" , ( ) => {
41
- it ( "it shouldn't detect Model when no file path is provided" , ( ) => {
41
+ it ( "shouldn't detect Model when no file path is provided" , ( ) => {
42
42
const node = parse ( 'CustomModel.extend()' ) ;
43
43
expect ( emberUtils . isDSModel ( node ) ) . toBeFalsy ( ) ;
44
44
} ) ;
45
45
46
- it ( 'it should detect Model when file path is provided' , ( ) => {
46
+ it ( 'should detect Model when file path is provided' , ( ) => {
47
47
const node = parse ( 'CustomModel.extend()' ) ;
48
48
const filePath = 'example-app/models/path/to/some-model.js' ;
49
49
expect ( emberUtils . isDSModel ( node , filePath ) ) . toBeTruthy ( ) ;
@@ -98,7 +98,7 @@ describe('isTestFile', () => {
98
98
} ) ;
99
99
100
100
describe ( 'isEmberCoreModule' , ( ) => {
101
- it ( 'should check if current file is a component' , ( ) => {
101
+ it ( 'should check if current file is a component (custom) ' , ( ) => {
102
102
const context = new FauxContext (
103
103
'CustomComponent.extend()' ,
104
104
'example-app/components/path/to/some-component.js'
@@ -116,7 +116,7 @@ describe('isEmberCoreModule', () => {
116
116
expect ( emberUtils . isEmberCoreModule ( context , node , 'Component' ) ) . toBeTruthy ( ) ;
117
117
} ) ;
118
118
119
- it ( 'should check if current file is a controller' , ( ) => {
119
+ it ( 'should check if current file is a controller (custom) ' , ( ) => {
120
120
const context = new FauxContext (
121
121
'CustomController.extend()' ,
122
122
'example-app/controllers/path/to/some-controller.js'
@@ -134,7 +134,7 @@ describe('isEmberCoreModule', () => {
134
134
expect ( emberUtils . isEmberCoreModule ( context , node , 'Controller' ) ) . toBeTruthy ( ) ;
135
135
} ) ;
136
136
137
- it ( 'should check if current file is a route' , ( ) => {
137
+ it ( 'should check if current file is a route (custom) ' , ( ) => {
138
138
const context = new FauxContext (
139
139
'CustomRoute.extend()' ,
140
140
'example-app/routes/path/to/some-route.js'
@@ -163,13 +163,13 @@ describe('isEmberCoreModule', () => {
163
163
164
164
describe ( 'isEmberComponent' , ( ) => {
165
165
describe ( "should check if it's an Ember Component" , ( ) => {
166
- it ( 'it should detect Component when using Ember.Component' , ( ) => {
166
+ it ( 'should detect Component when using Ember.Component' , ( ) => {
167
167
const context = new FauxContext ( 'Ember.Component.extend()' ) ;
168
168
const node = context . ast . body [ 0 ] . expression ;
169
169
expect ( emberUtils . isEmberComponent ( context , node ) ) . toBeTruthy ( ) ;
170
170
} ) ;
171
171
172
- it ( 'it should detect Component when using local module Component' , ( ) => {
172
+ it ( 'should detect Component when using local module Component' , ( ) => {
173
173
const context = new FauxContext ( 'Component.extend()' ) ;
174
174
const node = context . ast . body [ 0 ] . expression ;
175
175
expect ( emberUtils . isEmberComponent ( context , node ) ) . toBeTruthy ( ) ;
@@ -195,13 +195,13 @@ describe('isEmberComponent', () => {
195
195
} ) ;
196
196
197
197
describe ( "should check if it's an Ember Component even if it uses custom name" , ( ) => {
198
- it ( "it shouldn't detect Component when no file path is provided" , ( ) => {
198
+ it ( "shouldn't detect Component when no file path is provided" , ( ) => {
199
199
const context = new FauxContext ( 'CustomComponent.extend()' ) ;
200
200
const node = context . ast . body [ 0 ] . expression ;
201
201
expect ( emberUtils . isEmberComponent ( context , node ) ) . toBeFalsy ( ) ;
202
202
} ) ;
203
203
204
- it ( 'it should detect Component when file path is provided' , ( ) => {
204
+ it ( 'should detect Component when file path is provided' , ( ) => {
205
205
const context = new FauxContext (
206
206
'CustomComponent.extend()' ,
207
207
'example-app/components/path/to/some-component.js'
@@ -223,13 +223,13 @@ describe('isEmberComponent', () => {
223
223
224
224
describe ( 'isEmberController' , ( ) => {
225
225
describe ( "should check if it's an Ember Controller" , ( ) => {
226
- it ( 'it should detect Controller when using Ember.Controller' , ( ) => {
226
+ it ( 'should detect Controller when using Ember.Controller' , ( ) => {
227
227
const context = new FauxContext ( 'Ember.Controller.extend()' ) ;
228
228
const node = context . ast . body [ 0 ] . expression ;
229
229
expect ( emberUtils . isEmberController ( context , node ) ) . toBeTruthy ( ) ;
230
230
} ) ;
231
231
232
- it ( 'it should detect Controller when using local module Controller' , ( ) => {
232
+ it ( 'should detect Controller when using local module Controller' , ( ) => {
233
233
const context = new FauxContext ( 'Controller.extend()' ) ;
234
234
const node = context . ast . body [ 0 ] . expression ;
235
235
expect ( emberUtils . isEmberController ( context , node ) ) . toBeTruthy ( ) ;
@@ -255,13 +255,13 @@ describe('isEmberController', () => {
255
255
} ) ;
256
256
257
257
describe ( "should check if it's an Ember Controller even if it uses custom name" , ( ) => {
258
- it ( "it shouldn't detect Controller when no file path is provided" , ( ) => {
258
+ it ( "shouldn't detect Controller when no file path is provided" , ( ) => {
259
259
const context = new FauxContext ( 'CustomController.extend()' ) ;
260
260
const node = context . ast . body [ 0 ] . expression ;
261
261
expect ( emberUtils . isEmberController ( context , node ) ) . toBeFalsy ( ) ;
262
262
} ) ;
263
263
264
- it ( 'it should detect Controller when file path is provided' , ( ) => {
264
+ it ( 'should detect Controller when file path is provided' , ( ) => {
265
265
const context = new FauxContext (
266
266
'CustomController.extend()' ,
267
267
'example-app/controllers/path/to/some-feature.js'
@@ -315,13 +315,13 @@ describe('isEmberRoute', () => {
315
315
} ) ;
316
316
317
317
describe ( "should check if it's an Ember Route even if it uses custom name" , ( ) => {
318
- it ( "it shouldn't detect Route when no file path is provided" , ( ) => {
318
+ it ( "shouldn't detect Route when no file path is provided" , ( ) => {
319
319
const context = new FauxContext ( 'CustomRoute.extend()' ) ;
320
320
const node = context . ast . body [ 0 ] . expression ;
321
321
expect ( emberUtils . isEmberRoute ( context , node ) ) . toBeFalsy ( ) ;
322
322
} ) ;
323
323
324
- it ( 'it should detect Route when file path is provided' , ( ) => {
324
+ it ( 'should detect Route when file path is provided' , ( ) => {
325
325
const context = new FauxContext (
326
326
'CustomRoute.extend()' ,
327
327
'example-app/routes/path/to/some-feature.js'
@@ -415,7 +415,7 @@ describe('isEmberService', () => {
415
415
expect ( emberUtils . isEmberService ( context , node ) ) . toBeFalsy ( ) ;
416
416
} ) ;
417
417
418
- it ( 'it should detect Service when file path is provided' , ( ) => {
418
+ it ( 'should detect Service when file path is provided' , ( ) => {
419
419
const context = new FauxContext (
420
420
'CustomService.extend()' ,
421
421
'example-app/services/path/to/some-feature.js'
@@ -1031,38 +1031,50 @@ describe('isRelation', () => {
1031
1031
describe ( 'parseDependentKeys' , ( ) => {
1032
1032
it ( 'should parse dependent keys from callexpression' , ( ) => {
1033
1033
const node = parse ( "computed('model.{foo,bar}', 'model.bar')" ) ;
1034
- expect ( emberUtils . parseDependentKeys ( node ) ) . toEqual ( [ 'model.foo' , 'model.bar' , 'model.bar' ] ) ;
1034
+ expect ( emberUtils . parseDependentKeys ( node ) ) . toStrictEqual ( [
1035
+ 'model.foo' ,
1036
+ 'model.bar' ,
1037
+ 'model.bar' ,
1038
+ ] ) ;
1035
1039
} ) ;
1036
1040
1037
1041
it ( 'should work when no dependent keys present' , ( ) => {
1038
1042
const node = parse ( 'computed(function() {})' ) ;
1039
- expect ( emberUtils . parseDependentKeys ( node ) ) . toEqual ( [ ] ) ;
1043
+ expect ( emberUtils . parseDependentKeys ( node ) ) . toStrictEqual ( [ ] ) ;
1040
1044
} ) ;
1041
1045
1042
1046
it ( 'should handle dependent keys and function arguments' , ( ) => {
1043
1047
const node = parse ( "computed('model.{foo,bar}', 'model.bar', function() {})" ) ;
1044
- expect ( emberUtils . parseDependentKeys ( node ) ) . toEqual ( [ 'model.foo' , 'model.bar' , 'model.bar' ] ) ;
1048
+ expect ( emberUtils . parseDependentKeys ( node ) ) . toStrictEqual ( [
1049
+ 'model.foo' ,
1050
+ 'model.bar' ,
1051
+ 'model.bar' ,
1052
+ ] ) ;
1045
1053
} ) ;
1046
1054
1047
1055
it ( 'should handle dependent keys and function arguments in MemberExpression' , ( ) => {
1048
1056
const node = parse ( `
1049
1057
computed('model.{foo,bar}', 'model.bar', function() {
1050
1058
}).volatile();
1051
1059
` ) ;
1052
- expect ( emberUtils . parseDependentKeys ( node ) ) . toEqual ( [ 'model.foo' , 'model.bar' , 'model.bar' ] ) ;
1060
+ expect ( emberUtils . parseDependentKeys ( node ) ) . toStrictEqual ( [
1061
+ 'model.foo' ,
1062
+ 'model.bar' ,
1063
+ 'model.bar' ,
1064
+ ] ) ;
1053
1065
} ) ;
1054
1066
} ) ;
1055
1067
1056
1068
describe ( 'unwrapBraceExpressions' , ( ) => {
1057
1069
it ( 'should unwrap simple dependent keys' , ( ) => {
1058
- expect ( emberUtils . unwrapBraceExpressions ( [ 'model.foo' , 'model.bar' ] ) ) . toEqual ( [
1070
+ expect ( emberUtils . unwrapBraceExpressions ( [ 'model.foo' , 'model.bar' ] ) ) . toStrictEqual ( [
1059
1071
'model.foo' ,
1060
1072
'model.bar' ,
1061
1073
] ) ;
1062
1074
} ) ;
1063
1075
1064
1076
it ( 'should unwrap dependent keys with braces' , ( ) => {
1065
- expect ( emberUtils . unwrapBraceExpressions ( [ 'model.{foo,bar}' , 'model.bar' ] ) ) . toEqual ( [
1077
+ expect ( emberUtils . unwrapBraceExpressions ( [ 'model.{foo,bar}' , 'model.bar' ] ) ) . toStrictEqual ( [
1066
1078
'model.foo' ,
1067
1079
'model.bar' ,
1068
1080
'model.bar' ,
@@ -1072,33 +1084,31 @@ describe('unwrapBraceExpressions', () => {
1072
1084
it ( 'should unwrap more complex dependent keys' , ( ) => {
1073
1085
expect (
1074
1086
emberUtils . unwrapBraceExpressions ( [ 'model.{foo,bar}' , 'model.bar' , 'data.{foo,baz,qux}' ] )
1075
- ) . toEqual ( [ 'model.foo' , 'model.bar' , 'model.bar' , 'data.foo' , 'data.baz' , 'data.qux' ] ) ;
1087
+ ) . toStrictEqual ( [ 'model.foo' , 'model.bar' , 'model.bar' , 'data.foo' , 'data.baz' , 'data.qux' ] ) ;
1076
1088
} ) ;
1077
1089
1078
1090
it ( 'should unwrap multi-level keys' , ( ) => {
1079
- expect ( emberUtils . unwrapBraceExpressions ( [ 'model.bar.{foo,qux}' , 'model.bar.baz' ] ) ) . toEqual ( [
1080
- 'model.bar.foo' ,
1081
- 'model.bar.qux' ,
1082
- 'model.bar.baz' ,
1083
- ] ) ;
1091
+ expect (
1092
+ emberUtils . unwrapBraceExpressions ( [ 'model.bar.{foo,qux}' , 'model.bar.baz' ] )
1093
+ ) . toStrictEqual ( [ 'model.bar.foo' , 'model.bar.qux' , 'model.bar.baz' ] ) ;
1084
1094
} ) ;
1085
1095
1086
1096
it ( 'should unwrap @each with extensions' , ( ) => {
1087
1097
expect (
1088
1098
emberUtils . unwrapBraceExpressions ( [ 'collection.@each.{foo,bar}' , '[email protected] ' ] )
1089
-
1099
+
1090
1100
} ) ;
1091
1101
1092
1102
it ( 'should unwrap complicated mixed dependent keys' , ( ) => {
1093
- expect ( emberUtils . unwrapBraceExpressions ( [ 'a.b.c.{[email protected] ,f,g.[]}' ] ) ) . toEqual ( [
1103
+ expect ( emberUtils . unwrapBraceExpressions ( [ 'a.b.c.{[email protected] ,f,g.[]}' ] ) ) . toStrictEqual ( [
1094
1104
1095
1105
'a.b.c.f' ,
1096
1106
'a.b.c.g.[]' ,
1097
1107
] ) ;
1098
1108
} ) ;
1099
1109
1100
1110
it ( 'should unwrap complicated mixed repeated dependent keys' , ( ) => {
1101
- expect ( emberUtils . unwrapBraceExpressions ( [ 'a.b.{[email protected] ,f,[email protected] }' ] ) ) . toEqual ( [
1111
+ expect ( emberUtils . unwrapBraceExpressions ( [ 'a.b.{[email protected] ,f,[email protected] }' ] ) ) . toStrictEqual ( [
1102
1112
1103
1113
'a.b.f' ,
1104
1114
@@ -1139,7 +1149,7 @@ describe('hasDuplicateDependentKeys', () => {
1139
1149
describe ( 'getEmberImportAliasName' , ( ) => {
1140
1150
it ( 'should get the proper name of default import' , ( ) => {
1141
1151
const node = babelEslint . parse ( "import foo from 'ember'" ) . body [ 0 ] ;
1142
- expect ( emberUtils . getEmberImportAliasName ( node ) ) . toEqual ( 'foo' ) ;
1152
+ expect ( emberUtils . getEmberImportAliasName ( node ) ) . toStrictEqual ( 'foo' ) ;
1143
1153
} ) ;
1144
1154
} ) ;
1145
1155
0 commit comments