@@ -76,7 +76,7 @@ describe('a configuration map', () => {
76
76
it ( 'contains the variable' , ( ) => {
77
77
expect ( node . size ) . toBe ( 1 ) ;
78
78
const variable = [ ...node . variables ( ) ] [ 0 ] ;
79
- expect ( variable . variableName ) . toEqual ( 'bar' ) ;
79
+ expect ( variable . name ) . toEqual ( 'bar' ) ;
80
80
expect ( variable ) . toHaveStringExpression ( 'expression' , 'baz' ) ;
81
81
} ) ;
82
82
} ) ;
@@ -101,9 +101,7 @@ describe('a configuration map', () => {
101
101
'variables array' ,
102
102
( ) =>
103
103
new Configuration ( {
104
- variables : [
105
- { variableName : 'bar' , expression : { text : 'baz' , quotes : true } } ,
106
- ] ,
104
+ variables : [ { name : 'bar' , expression : { text : 'baz' , quotes : true } } ] ,
107
105
} ) ,
108
106
) ;
109
107
@@ -127,7 +125,7 @@ describe('a configuration map', () => {
127
125
describe ( 'add()' , ( ) => {
128
126
test ( 'with a ConfiguredVariable' , ( ) => {
129
127
const variable = new ConfiguredVariable ( {
130
- variableName : 'foo' ,
128
+ name : 'foo' ,
131
129
expression : { text : 'bar' , quotes : true } ,
132
130
} ) ;
133
131
expect ( node . add ( variable ) ) . toBe ( node ) ;
@@ -137,29 +135,29 @@ describe('a configuration map', () => {
137
135
} ) ;
138
136
139
137
test ( 'with a ConfiguredVariableProps' , ( ) => {
140
- node . add ( { variableName : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
138
+ node . add ( { name : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
141
139
expect ( node . size ) . toBe ( 1 ) ;
142
140
const variable = node . get ( 'foo' ) ;
143
- expect ( variable ?. variableName ) . toBe ( 'foo' ) ;
141
+ expect ( variable ?. name ) . toBe ( 'foo' ) ;
144
142
expect ( variable ) . toHaveStringExpression ( 'expression' , 'bar' ) ;
145
143
expect ( variable ?. parent ) . toBe ( node ) ;
146
144
} ) ;
147
145
148
146
test ( 'overwrites on old variable' , ( ) => {
149
- node . add ( { variableName : 'foo' , expression : { text : 'old' , quotes : true } } ) ;
147
+ node . add ( { name : 'foo' , expression : { text : 'old' , quotes : true } } ) ;
150
148
const old = node . get ( 'foo' ) ;
151
149
expect ( old ?. parent ) . toBe ( node ) ;
152
150
153
- node . add ( { variableName : 'foo' , expression : { text : 'new' , quotes : true } } ) ;
151
+ node . add ( { name : 'foo' , expression : { text : 'new' , quotes : true } } ) ;
154
152
expect ( node . size ) . toBe ( 1 ) ;
155
153
expect ( old ?. parent ) . toBeUndefined ( ) ;
156
154
expect ( node . get ( 'foo' ) ) . toHaveStringExpression ( 'expression' , 'new' ) ;
157
155
} ) ;
158
156
} ) ;
159
157
160
158
test ( 'clear() removes all variables' , ( ) => {
161
- node . add ( { variableName : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
162
- node . add ( { variableName : 'baz' , expression : { text : 'bang' , quotes : true } } ) ;
159
+ node . add ( { name : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
160
+ node . add ( { name : 'baz' , expression : { text : 'bang' , quotes : true } } ) ;
163
161
const foo = node . get ( 'foo' ) ;
164
162
const bar = node . get ( 'bar' ) ;
165
163
node . clear ( ) ;
@@ -172,8 +170,8 @@ describe('a configuration map', () => {
172
170
173
171
describe ( 'delete()' , ( ) => {
174
172
beforeEach ( ( ) => {
175
- node . add ( { variableName : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
176
- node . add ( { variableName : 'baz' , expression : { text : 'bang' , quotes : true } } ) ;
173
+ node . add ( { name : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
174
+ node . add ( { name : 'baz' , expression : { text : 'bang' , quotes : true } } ) ;
177
175
} ) ;
178
176
179
177
test ( 'removes a matching variable' , ( ) => {
@@ -192,12 +190,12 @@ describe('a configuration map', () => {
192
190
193
191
describe ( 'get()' , ( ) => {
194
192
beforeEach ( ( ) => {
195
- node . add ( { variableName : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
193
+ node . add ( { name : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
196
194
} ) ;
197
195
198
196
test ( 'returns a variable in the configuration' , ( ) => {
199
197
const variable = node . get ( 'foo' ) ;
200
- expect ( variable ?. variableName ) . toBe ( 'foo' ) ;
198
+ expect ( variable ?. name ) . toBe ( 'foo' ) ;
201
199
expect ( variable ) . toHaveStringExpression ( 'expression' , 'bar' ) ;
202
200
} ) ;
203
201
@@ -208,7 +206,7 @@ describe('a configuration map', () => {
208
206
209
207
describe ( 'has()' , ( ) => {
210
208
beforeEach ( ( ) => {
211
- node . add ( { variableName : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
209
+ node . add ( { name : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
212
210
} ) ;
213
211
214
212
test ( 'returns true for a variable in the configuration' , ( ) =>
@@ -220,7 +218,7 @@ describe('a configuration map', () => {
220
218
221
219
describe ( 'set()' , ( ) => {
222
220
beforeEach ( ( ) => {
223
- node . add ( { variableName : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
221
+ node . add ( { name : 'foo' , expression : { text : 'bar' , quotes : true } } ) ;
224
222
} ) ;
225
223
226
224
describe ( 'adds a new variable' , ( ) => {
@@ -233,7 +231,7 @@ describe('a configuration map', () => {
233
231
expect ( node . size ) . toBe ( 2 ) ;
234
232
const variable = node . get ( 'baz' ) ;
235
233
expect ( variable ?. parent ) . toBe ( node ) ;
236
- expect ( variable ?. variableName ) . toBe ( 'baz' ) ;
234
+ expect ( variable ?. name ) . toBe ( 'baz' ) ;
237
235
expect ( variable ) . toHaveStringExpression ( 'expression' , 'bang' ) ;
238
236
} ) ;
239
237
}
@@ -285,15 +283,15 @@ describe('a configuration map', () => {
285
283
} ) . toString ( ) ,
286
284
) . toBe ( '($foo: "bar", $baz: "bang",)' ) ) ;
287
285
288
- it ( 'with comma: true and afterValue ' , ( ) =>
286
+ it ( 'with comma: true and after ' , ( ) =>
289
287
expect (
290
288
new Configuration ( {
291
289
raws : { comma : true } ,
292
290
variables : {
293
291
foo : { text : 'bar' , quotes : true } ,
294
292
baz : {
295
293
expression : { text : 'bang' , quotes : true } ,
296
- raws : { afterValue : '/**/' } ,
294
+ raws : { after : '/**/' } ,
297
295
} ,
298
296
} ,
299
297
} ) . toString ( ) ,
@@ -310,28 +308,28 @@ describe('a configuration map', () => {
310
308
} ) . toString ( ) ,
311
309
) . toBe ( '($foo: "bar", $baz: "bang"/**/)' ) ) ;
312
310
313
- it ( 'with after and afterValue ' , ( ) =>
311
+ it ( 'with after and after ' , ( ) =>
314
312
expect (
315
313
new Configuration ( {
316
314
raws : { after : '/**/' } ,
317
315
variables : {
318
316
foo : { text : 'bar' , quotes : true } ,
319
317
baz : {
320
318
expression : { text : 'bang' , quotes : true } ,
321
- raws : { afterValue : ' ' } ,
319
+ raws : { after : ' ' } ,
322
320
} ,
323
321
} ,
324
322
} ) . toString ( ) ,
325
323
) . toBe ( '($foo: "bar", $baz: "bang" /**/)' ) ) ;
326
324
327
- it ( 'with afterValue and a guard' , ( ) =>
325
+ it ( 'with after and a guard' , ( ) =>
328
326
expect (
329
327
new Configuration ( {
330
328
variables : {
331
329
foo : { text : 'bar' , quotes : true } ,
332
330
baz : {
333
331
expression : { text : 'bang' , quotes : true } ,
334
- raws : { afterValue : '/**/' } ,
332
+ raws : { after : '/**/' } ,
335
333
guarded : true ,
336
334
} ,
337
335
} ,
@@ -359,10 +357,10 @@ describe('a configuration map', () => {
359
357
it ( 'variables' , ( ) => {
360
358
expect ( clone . size ) . toBe ( 2 ) ;
361
359
const variables = [ ...clone . variables ( ) ] ;
362
- expect ( variables [ 0 ] ?. variableName ) . toBe ( 'foo' ) ;
360
+ expect ( variables [ 0 ] ?. name ) . toBe ( 'foo' ) ;
363
361
expect ( variables [ 0 ] ?. parent ) . toBe ( clone ) ;
364
362
expect ( variables [ 0 ] ) . toHaveStringExpression ( 'expression' , 'bar' ) ;
365
- expect ( variables [ 1 ] ?. variableName ) . toBe ( 'baz' ) ;
363
+ expect ( variables [ 1 ] ?. name ) . toBe ( 'baz' ) ;
366
364
expect ( variables [ 1 ] ?. parent ) . toBe ( clone ) ;
367
365
expect ( variables [ 1 ] ) . toHaveStringExpression ( 'expression' , 'bang' ) ;
368
366
} ) ;
@@ -399,7 +397,7 @@ describe('a configuration map', () => {
399
397
} ) ;
400
398
expect ( clone . size ) . toBe ( 1 ) ;
401
399
const variables = [ ...clone . variables ( ) ] ;
402
- expect ( variables [ 0 ] ?. variableName ) . toBe ( 'zip' ) ;
400
+ expect ( variables [ 0 ] ?. name ) . toBe ( 'zip' ) ;
403
401
expect ( variables [ 0 ] ?. parent ) . toBe ( clone ) ;
404
402
expect ( variables [ 0 ] ) . toHaveStringExpression ( 'expression' , 'zap' ) ;
405
403
} ) ;
@@ -408,10 +406,10 @@ describe('a configuration map', () => {
408
406
const clone = original . clone ( { variables : undefined } ) ;
409
407
expect ( clone . size ) . toBe ( 2 ) ;
410
408
const variables = [ ...clone . variables ( ) ] ;
411
- expect ( variables [ 0 ] ?. variableName ) . toBe ( 'foo' ) ;
409
+ expect ( variables [ 0 ] ?. name ) . toBe ( 'foo' ) ;
412
410
expect ( variables [ 0 ] ?. parent ) . toBe ( clone ) ;
413
411
expect ( variables [ 0 ] ) . toHaveStringExpression ( 'expression' , 'bar' ) ;
414
- expect ( variables [ 1 ] ?. variableName ) . toBe ( 'baz' ) ;
412
+ expect ( variables [ 1 ] ?. name ) . toBe ( 'baz' ) ;
415
413
expect ( variables [ 1 ] ?. parent ) . toBe ( clone ) ;
416
414
expect ( variables [ 1 ] ) . toHaveStringExpression ( 'expression' , 'bang' ) ;
417
415
} ) ;
0 commit comments