@@ -54,7 +54,7 @@ QUnit.test( 'Constructor (positive)', function( assert ) {
54
54
var expectedItem = map . getItemByKey ( languageCodes [ j ] ) ;
55
55
56
56
assert . ok (
57
- fingerprint [ functionNames [ term ] [ 1 ] ] ( languageCodes [ j ] , expectedItem ) ,
57
+ fingerprint [ functionNames [ term ] [ 1 ] ] ( expectedItem ) ,
58
58
'Test set #' + i + ': Verified result of ' + functionNames [ term ] [ 1 ]
59
59
+ ' for language #' + languageCodes [ j ] + '.'
60
60
) ;
@@ -126,30 +126,23 @@ QUnit.test( 'Constructor (negative)', function( assert ) {
126
126
} ) ;
127
127
128
128
QUnit . test ( 'setLabel()' , function ( assert ) {
129
- assert . expect ( 4 ) ;
129
+ assert . expect ( 3 ) ;
130
130
var fingerprint = new wb . datamodel . Fingerprint ( ) ,
131
131
label = new wb . datamodel . Term ( 'de' , 'de-label' ) ;
132
132
133
133
assert . ok (
134
- ! fingerprint . hasLabel ( 'de' , label ) ,
134
+ ! fingerprint . hasLabel ( label ) ,
135
135
'Verified fingerprint not featuring the label that will be added.'
136
136
) ;
137
137
138
- assert . throws (
139
- function ( ) {
140
- fingerprint . setLabel ( label ) ;
141
- } ,
142
- 'Throwing error when trying to set a label without specifying a language code.'
143
- ) ;
144
-
145
- fingerprint . setLabel ( 'de' , label ) ;
138
+ fingerprint . setLabel ( label ) ;
146
139
147
140
assert . ok (
148
- fingerprint . hasLabel ( 'de' , label ) ,
141
+ fingerprint . hasLabel ( label ) ,
149
142
'Set label.'
150
143
) ;
151
144
152
- fingerprint . setLabel ( 'de' , new wb . datamodel . Term ( 'de' , '' ) ) ;
145
+ fingerprint . setLabel ( new wb . datamodel . Term ( 'de' , '' ) ) ;
153
146
154
147
assert . ok (
155
148
! fingerprint . hasLabelFor ( 'de' ) ,
@@ -158,26 +151,19 @@ QUnit.test( 'setLabel()', function( assert ) {
158
151
} ) ;
159
152
160
153
QUnit . test ( 'removeLabel()' , function ( assert ) {
161
- assert . expect ( 3 ) ;
154
+ assert . expect ( 2 ) ;
162
155
var label = new wb . datamodel . Term ( 'de' , 'de-label' ) ,
163
156
fingerprint = new wb . datamodel . Fingerprint ( new wb . datamodel . TermMap ( { de : label } ) ) ;
164
157
165
158
assert . ok (
166
- fingerprint . hasLabel ( 'de' , label ) ,
159
+ fingerprint . hasLabel ( label ) ,
167
160
'Verified fingerprint featuring the label to be removed.'
168
161
) ;
169
162
170
- assert . throws (
171
- function ( ) {
172
- fingerprint . removeLabel ( label ) ;
173
- } ,
174
- 'Throwing error when trying to remove a label without specifying a language code.'
175
- ) ;
176
-
177
- fingerprint . removeLabel ( 'de' , label ) ;
163
+ fingerprint . removeLabel ( label ) ;
178
164
179
165
assert . ok (
180
- ! fingerprint . hasLabel ( 'de' , label ) ,
166
+ ! fingerprint . hasLabel ( label ) ,
181
167
'Removed label.'
182
168
) ;
183
169
} ) ;
@@ -188,43 +174,36 @@ QUnit.test( 'removeLabelFor()', function( assert ) {
188
174
fingerprint = new wb . datamodel . Fingerprint ( new wb . datamodel . TermMap ( { de : label } ) ) ;
189
175
190
176
assert . ok (
191
- fingerprint . hasLabel ( 'de' , label ) ,
177
+ fingerprint . hasLabel ( label ) ,
192
178
'Verified fingerprint featuring the label to be removed.'
193
179
) ;
194
180
195
181
fingerprint . removeLabelFor ( 'de' ) ;
196
182
197
183
assert . ok (
198
- ! fingerprint . hasLabel ( 'de' , label ) ,
184
+ ! fingerprint . hasLabel ( label ) ,
199
185
'Removed label.'
200
186
) ;
201
187
} ) ;
202
188
203
189
QUnit . test ( 'setDescription()' , function ( assert ) {
204
- assert . expect ( 4 ) ;
190
+ assert . expect ( 3 ) ;
205
191
var fingerprint = new wb . datamodel . Fingerprint ( ) ,
206
192
description = new wb . datamodel . Term ( 'de' , 'de-description' ) ;
207
193
208
194
assert . ok (
209
- ! fingerprint . hasDescription ( 'de' , description ) ,
195
+ ! fingerprint . hasDescription ( description ) ,
210
196
'Verified fingerprint not featuring the description that will be added.'
211
197
) ;
212
198
213
- assert . throws (
214
- function ( ) {
215
- fingerprint . setDescription ( description ) ;
216
- } ,
217
- 'Throwing error when trying to set a description without specifying a language code.'
218
- ) ;
219
-
220
- fingerprint . setDescription ( 'de' , description ) ;
199
+ fingerprint . setDescription ( description ) ;
221
200
222
201
assert . ok (
223
- fingerprint . hasDescription ( 'de' , description ) ,
202
+ fingerprint . hasDescription ( description ) ,
224
203
'Set description.'
225
204
) ;
226
205
227
- fingerprint . setDescription ( 'de' , new wb . datamodel . Term ( 'de' , '' ) ) ;
206
+ fingerprint . setDescription ( new wb . datamodel . Term ( 'de' , '' ) ) ;
228
207
229
208
assert . ok (
230
209
! fingerprint . hasDescriptionFor ( 'de' ) ,
@@ -233,29 +212,22 @@ QUnit.test( 'setDescription()', function( assert ) {
233
212
} ) ;
234
213
235
214
QUnit . test ( 'removeDescription()' , function ( assert ) {
236
- assert . expect ( 3 ) ;
215
+ assert . expect ( 2 ) ;
237
216
var description = new wb . datamodel . Term ( 'de' , 'de-description' ) ,
238
217
fingerprint = new wb . datamodel . Fingerprint (
239
218
null ,
240
219
new wb . datamodel . TermMap ( { de : description } )
241
220
) ;
242
221
243
222
assert . ok (
244
- fingerprint . hasDescription ( 'de' , description ) ,
223
+ fingerprint . hasDescription ( description ) ,
245
224
'Verified fingerprint featuring the description to be removed.'
246
225
) ;
247
226
248
- assert . throws (
249
- function ( ) {
250
- fingerprint . removeDescription ( description ) ;
251
- } ,
252
- 'Throwing error when trying to remove a description without specifying a language code.'
253
- ) ;
254
-
255
- fingerprint . removeDescription ( 'de' , description ) ;
227
+ fingerprint . removeDescription ( description ) ;
256
228
257
229
assert . ok (
258
- ! fingerprint . hasDescription ( 'de' , description ) ,
230
+ ! fingerprint . hasDescription ( description ) ,
259
231
'Removed description.'
260
232
) ;
261
233
} ) ;
@@ -269,41 +241,34 @@ QUnit.test( 'removeDescriptionFor()', function( assert ) {
269
241
) ;
270
242
271
243
assert . ok (
272
- fingerprint . hasDescription ( 'de' , description ) ,
244
+ fingerprint . hasDescription ( description ) ,
273
245
'Verified fingerprint featuring the description to be removed.'
274
246
) ;
275
247
276
248
fingerprint . removeDescriptionFor ( description . getLanguageCode ( ) ) ;
277
249
278
250
assert . ok (
279
- ! fingerprint . hasDescription ( 'de' , description ) ,
251
+ ! fingerprint . hasDescription ( description ) ,
280
252
'Removed description.'
281
253
) ;
282
254
} ) ;
283
255
284
256
QUnit . test ( 'setAliases()' , function ( assert ) {
285
- assert . expect ( 8 ) ;
257
+ assert . expect ( 6 ) ;
286
258
var fingerprint = new wb . datamodel . Fingerprint ( ) ,
287
259
deAliases = new wb . datamodel . MultiTerm ( 'de' , [ 'de-alias' ] ) ,
288
260
enAliases = new wb . datamodel . MultiTerm ( 'en' , [ 'en-alias' ] ) ,
289
261
aliases = new wb . datamodel . MultiTermMap ( { en : enAliases } ) ;
290
262
291
263
assert . ok (
292
- ! fingerprint . hasAliases ( 'de' , deAliases ) ,
264
+ ! fingerprint . hasAliases ( deAliases ) ,
293
265
'Verified fingerprint not featuring the aliases that will be added.'
294
266
) ;
295
267
296
- assert . throws (
297
- function ( ) {
298
- fingerprint . setAliases ( deAliases ) ;
299
- } ,
300
- 'Throwing error when trying to set a MultiTerm without specifying a language code.'
301
- ) ;
302
-
303
- fingerprint . setAliases ( 'de' , deAliases ) ;
268
+ fingerprint . setAliases ( deAliases ) ;
304
269
305
270
assert . ok (
306
- fingerprint . hasAliases ( 'de' , deAliases ) ,
271
+ fingerprint . hasAliases ( deAliases ) ,
307
272
'Set aliases passing a MultiTerm object.'
308
273
) ;
309
274
@@ -315,34 +280,27 @@ QUnit.test( 'setAliases()', function( assert ) {
315
280
) ;
316
281
317
282
assert . ok (
318
- ! fingerprint . hasAliases ( 'en' , enAliases ) ,
283
+ ! fingerprint . hasAliases ( enAliases ) ,
319
284
'Verified fingerprint not featuring the aliases that will be added.'
320
285
) ;
321
286
322
287
fingerprint . setAliases ( aliases ) ;
323
288
324
289
assert . ok (
325
- fingerprint . hasAliases ( 'en' , enAliases ) ,
290
+ fingerprint . hasAliases ( enAliases ) ,
326
291
'Set aliases passing a MultiTermMap object.'
327
292
) ;
328
293
329
- fingerprint . setAliases ( 'en' , new wb . datamodel . MultiTerm ( 'en' , [ ] ) ) ;
294
+ fingerprint . setAliases ( new wb . datamodel . MultiTerm ( 'en' , [ ] ) ) ;
330
295
331
296
assert . ok (
332
297
! fingerprint . hasAliasesFor ( 'en' ) ,
333
298
'Set aliases with empty list removes aliases.'
334
299
) ;
335
-
336
- assert . throws (
337
- function ( ) {
338
- fingerprint . setAliases ( new wb . datamodel . MultiTerm ( 'en' , [ ] ) ) ;
339
- } ,
340
- 'Throwing error when trying to set an empty MultiTerm without specifying a language code.'
341
- ) ;
342
300
} ) ;
343
301
344
302
QUnit . test ( 'removeAliases()' , function ( assert ) {
345
- assert . expect ( 3 ) ;
303
+ assert . expect ( 2 ) ;
346
304
var aliases = new wb . datamodel . MultiTerm ( 'de' , [ 'de-alias' ] ) ,
347
305
fingerprint = new wb . datamodel . Fingerprint (
348
306
null ,
@@ -351,21 +309,14 @@ QUnit.test( 'removeAliases()', function( assert ) {
351
309
) ;
352
310
353
311
assert . ok (
354
- fingerprint . hasAliases ( 'de' , aliases ) ,
312
+ fingerprint . hasAliases ( aliases ) ,
355
313
'Verified fingerprint featuring the aliases to be removed.'
356
314
) ;
357
315
358
- assert . throws (
359
- function ( ) {
360
- fingerprint . removeAliases ( aliases ) ;
361
- } ,
362
- 'Throwing error when trying to remove aliases without specifying a language code.'
363
- ) ;
364
-
365
- fingerprint . removeAliases ( 'de' , aliases ) ;
316
+ fingerprint . removeAliases ( aliases ) ;
366
317
367
318
assert . ok (
368
- ! fingerprint . hasAliases ( 'de' , aliases ) ,
319
+ ! fingerprint . hasAliases ( aliases ) ,
369
320
'Removed aliases.'
370
321
) ;
371
322
} ) ;
@@ -380,14 +331,14 @@ QUnit.test( 'removeAliasesFor()', function( assert ) {
380
331
) ;
381
332
382
333
assert . ok (
383
- fingerprint . hasAliases ( 'de' , aliases ) ,
334
+ fingerprint . hasAliases ( aliases ) ,
384
335
'Verified fingerprint featuring the aliases to be removed.'
385
336
) ;
386
337
387
338
fingerprint . removeAliasesFor ( 'de' ) ;
388
339
389
340
assert . ok (
390
- ! fingerprint . hasAliases ( 'de' , aliases ) ,
341
+ ! fingerprint . hasAliases ( aliases ) ,
391
342
'Removed aliases.'
392
343
) ;
393
344
} ) ;
0 commit comments