-
Notifications
You must be signed in to change notification settings - Fork 70
/
AddTopicDialog.spec.js
671 lines (458 loc) · 22.6 KB
/
AddTopicDialog.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
import Vue from 'vue'
import * as api from 'src/api/monitorrent'
import AddTopicDialog from 'src/components/Topics/AddTopicDialog'
import Deferred from 'es2015-deferred'
describe('AddTopicDialog.vue', () => {
const defaultClientResult = {
fields: {},
name: 'downloader',
settings: {
path: '/path/to/folder'
}
}
const parseUrlResult = {
settings: {
display_name: 'Табу / Taboo',
quality: '720p'
},
form: [
{
type: 'row',
content: [
{
type: 'text',
label: 'Name',
flex: 70,
model: 'display_name'
},
{
options: ['SD', '720p', '1080p'],
type: 'select',
label: 'Quality',
flex: 30,
model: 'quality'
}
]
}
]
}
function createPromiseResolve (value) {
// For some cases Promise.resolve doesn't work as expected under PhantomJS
return new Promise(resolve => setTimeout(() => resolve(value)))
}
const sandbox = sinon.sandbox.create()
const createDefaultClientStub = (value) => sandbox.stub(api.default, 'defaultClient', () => createPromiseResolve(value || defaultClientResult))
const createParseUrlStub = (value) => sandbox.stub(api.default, 'parseUrl', () => createPromiseResolve(value || parseUrlResult))
const createGetTopicStub = (value) => sandbox.stub(api.default, 'getTopic', () => createPromiseResolve(value || parseUrlResult))
const wait = ms => new Promise(resolve => setTimeout(resolve, ms))
afterEach(function () {
sandbox.restore()
})
const Constructor = Vue.extend(AddTopicDialog)
it('call to defaultClient with supported downloadDir should not show download dir error and not disabled input', async function () {
const vm = new Constructor().$mount()
const supportedDefaultClientResult = {...defaultClientResult, ...{fields: {download_dir: '/path/to/dir'}, name: 'transmission'}}
const defaultClientStub = createDefaultClientStub(supportedDefaultClientResult)
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
expect(vm.$refs.downloadDirNotSupportedError).to.be.not.ok
expect(vm.$refs.downloadDirError).to.be.not.ok
await vm.defaultClient()
await Vue.nextTick()
expect(vm.additionalFields.downloadDir.support).to.be.equal(true)
expect(vm.additionalFields.downloadDir.path).to.be.equal(supportedDefaultClientResult.fields.download_dir)
expect(vm.additionalFields.downloadDir.defaultClientName).to.be.equal('transmission')
expect(defaultClientStub).to.have.been.called
expect(vm.$refs.downloadDirNotSupportedError).to.be.not.ok
expect(vm.$refs.downloadDirError).to.be.not.ok
expect(vm.$refs.downloadDirInput.disabled).to.be.false
expect(vm.$refs.downloadDirInput.value).to.be.equal(supportedDefaultClientResult.fields.download_dir)
})
it('call to defaultClient with not supported downloadDir should show download dir error and disabled input', async function () {
const vm = new Constructor().$mount()
const defaultClientStub = createDefaultClientStub()
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
expect(vm.$refs.downloadDirNotSupportedError).to.be.not.ok
expect(vm.$refs.downloadDirError).to.be.not.ok
await vm.defaultClient()
await Vue.nextTick()
expect(vm.additionalFields.downloadDir.support).to.be.equal(false)
expect(vm.additionalFields.downloadDir.path).to.be.empty
expect(vm.additionalFields.downloadDir.defaultClientName).to.be.equal('downloader')
expect(defaultClientStub).to.have.been.called
expect(vm.$refs.downloadDirNotSupportedError).to.be.ok
expect(vm.$refs.downloadDirError).to.be.not.ok
expect(vm.$refs.downloadDirInput.disabled).to.be.true
expect(vm.$refs.downloadDirInput.value).to.be.empty
})
it('failed call with unknown error to defaultClient should show download dir error and disabled input', async function () {
const vm = new Constructor().$mount()
const defaultClientDeferred = new Deferred()
const defaultClientStub = sandbox.stub(api.default, 'defaultClient', () => defaultClientDeferred.promise)
const consoleErrorStub = sandbox.stub(console, 'error')
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
expect(vm.$refs.downloadDirNotSupportedError).to.be.not.ok
expect(vm.$refs.downloadDirError).to.be.not.ok
const openPromise = vm.open()
const error = new Error('failed to get default client')
defaultClientDeferred.reject(error)
await openPromise
await Vue.nextTick()
expect(vm.additionalFields.downloadDir.support).to.be.equal(false)
expect(vm.additionalFields.downloadDir.path).to.be.empty
expect(vm.additionalFields.downloadDir.defaultClientName).to.be.empty
expect(vm.additionalFields.downloadDir.complete).to.be.false
expect(defaultClientStub).to.have.been.calledOnce
expect(defaultClientStub).to.have.been.called
expect(consoleErrorStub).to.have.been.calledOnce
expect(consoleErrorStub.lastCall.args[0]).to.equal(error)
expect(vm.$refs.downloadDirNotSupportedError).to.be.not.ok
expect(vm.$refs.downloadDirError).to.be.ok
expect(vm.$refs.downloadDirInput.disabled).to.be.true
expect(vm.$refs.downloadDirInput.value).to.be.empty
})
it('call to parseUrl should set status', async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
const parseUrlStub = createParseUrlStub()
const parseUrlSpy = sandbox.spy(vm, 'parseUrl')
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
await Vue.nextTick()
await parseUrlSpy.lastCall.returnValue
expect(vm.topic.parsed).to.be.ok
expect(vm.topic.form).to.be.eql({rows: parseUrlResult.form, model: parseUrlResult.settings})
expect(parseUrlStub).to.have.been.calledWith(url)
})
it('failed call with CantParse error to parseUrl should set error', async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
expect(vm.$refs.topicError).to.be.not.ok
const parseUrlDeferred = new Deferred()
const parseUrlStub = sandbox.stub(api.default, 'parseUrl', () => parseUrlDeferred.promise)
const parseUrlSpy = sandbox.spy(vm, 'parseUrl')
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
expect(parseUrlSpy).have.not.been.called
await Vue.nextTick()
expect(parseUrlSpy).have.been.calledOnce
const error = new Error(`CantParse`)
error.description = `Can't parse topic: ${url}`
parseUrlDeferred.reject(error)
await parseUrlSpy.lastCall.returnValue
await Vue.nextTick()
expect(parseUrlStub).to.have.been.calledWith(url)
expect(vm.topic.parsed).to.be.false
expect(vm.topic.form).to.be.eql({rows: []})
expect(vm.topic.error).to.be.equal(error.description)
expect(vm.$refs.topicError).to.be.ok
})
it('failed call with unknow error to parseUrl should set error and print error to console', async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
const parseUrlDeferred = new Deferred()
const parseUrlStub = sandbox.stub(api.default, 'parseUrl', () => parseUrlDeferred.promise)
const parseUrlSpy = sandbox.spy(vm, 'parseUrl')
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
expect(parseUrlSpy).have.not.been.called
await Vue.nextTick()
expect(parseUrlSpy).have.been.calledOnce
const consoleErrorStub = sandbox.stub(console, 'error')
const error = new Error(`NetworkError`)
parseUrlDeferred.reject(error)
await parseUrlSpy.lastCall.returnValue
expect(vm.topic.parsed).to.be.false
expect(vm.topic.form).to.be.eql({rows: []})
expect(vm.topic.error).to.contain(error.message)
expect(parseUrlSpy).have.been.calledOnce
expect(parseUrlStub).have.been.calledWith(url)
expect(consoleErrorStub).have.been.calledOnce
expect(consoleErrorStub.lastCall.args[0]).to.equal(error)
})
it('call to open should make dialog visible and call defaultClient', async function () {
const vm = new Constructor().$mount()
const defaultClientStub = createDefaultClientStub()
await Vue.nextTick()
expect(document.body.contains(vm.$el)).to.be.false
await vm.open()
await Vue.nextTick()
expect(document.body.contains(vm.$el)).to.be.true
expect(defaultClientStub).to.have.been.called
})
it(`call to open and then close should make dialog visible and then invisible`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
expect(document.body.contains(vm.$el)).to.be.false
createDefaultClientStub()
await vm.open()
await Vue.nextTick()
expect(document.body.contains(vm.$el)).to.be.true
vm.close()
await Vue.nextTick()
await new Promise(resolve => setTimeout(resolve, 500))
expect(document.body.contains(vm.$el)).to.be.false
})
it(`should allow to press 'add' button`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
createDefaultClientStub()
const parseUrlStub = createParseUrlStub()
const parseUrlSpy = sandbox.spy(vm, 'parseUrl')
await vm.open()
await Vue.nextTick()
// parseUrl already called because open() set topic.url to null
parseUrlSpy.reset()
expect(vm.topic.parsed).to.be.false
expect(vm.additionalFields.downloadDir.complete).to.be.ok
expect(vm.complete).to.be.false
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
await Vue.nextTick()
expect(parseUrlSpy).have.been.calledOnce
await parseUrlSpy.lastCall.returnValue
expect(vm.topic.parsed).to.be.ok
expect(vm.topic.form).to.be.eql({rows: parseUrlResult.form, model: parseUrlResult.settings})
expect(parseUrlStub).to.have.been.calledWith(url)
expect(vm.topic.parsed).to.be.ok
expect(vm.additionalFields.downloadDir.complete).to.be.ok
expect(vm.complete).to.be.ok
})
it(`should display loading for download dir after open and hide on finish`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
const defaultClientDeferred = new Deferred()
sandbox.stub(api.default, 'defaultClient', () => defaultClientDeferred.promise)
expect(vm.additionalFields.downloadDir.loading).to.be.false
const openPromise = vm.open()
await Vue.nextTick()
expect(vm.additionalFields.downloadDir.loading).to.be.true
expect(vm.$refs.downloadDirProgress.$el.style.opacity).to.equal('1')
defaultClientDeferred.resolve(defaultClientResult)
await openPromise
await Vue.nextTick()
expect(vm.additionalFields.downloadDir.loading).to.be.false
expect(vm.$refs.downloadDirProgress.$el.style.opacity).to.equal('0')
})
it(`should display loading for url after set topic url and hide on finish`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
const parseUrlDeferred = new Deferred()
sandbox.stub(api.default, 'parseUrl', () => parseUrlDeferred.promise)
expect(vm.topic.loading).to.be.false
const parseUrlSpy = sandbox.spy(vm, 'parseUrl')
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
await Vue.nextTick()
expect(parseUrlSpy).have.been.calledOnce
expect(vm.topic.loading).to.be.true
expect(vm.$refs.topicProgress.$el.style.opacity).to.equal('1')
parseUrlDeferred.resolve(parseUrlResult)
await parseUrlSpy.lastCall.returnValue
await Vue.nextTick()
expect(vm.topic.loading).to.be.false
expect(vm.$refs.topicProgress.$el.style.opacity).to.equal('0')
})
it(`should display loading for parse url after set topic.url and hide on finish`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
createDefaultClientStub()
const parseUrlDeferred = new Deferred()
sandbox.stub(api.default, 'parseUrl', () => parseUrlDeferred.promise)
expect(vm.topic.loading).to.be.false
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
await Vue.nextTick()
expect(vm.topic.loading).to.be.true
parseUrlDeferred.resolve(parseUrlResult)
await Vue.nextTick()
expect(vm.topic.loading).to.be.false
})
it(`click 'add' should raise add-topic event with correct model`, async function () {
const vm = new Constructor().$mount()
const addTopicEventFinished = new Promise(resolve => vm.$on('add-topic', resolve))
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
createDefaultClientStub()
createParseUrlStub()
const parseUrlSpy = sandbox.spy(vm, 'parseUrl')
await vm.open()
await Vue.nextTick()
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
await Vue.nextTick()
await parseUrlSpy.lastCall.returnValue
expect(vm.complete).to.be.ok
await Vue.nextTick()
vm.$refs.add.$el.click()
await Vue.nextTick()
const raiseIn10ms = wait(10).then(() => { throw new Error('Event was not executed') })
await Promise.race([addTopicEventFinished, raiseIn10ms])
const result = await addTopicEventFinished
expect(result.url).to.be.equal(url)
expect(result.settings.display_name).to.be.equal('Табу / Taboo')
expect(result.settings.quality).to.be.equal('720p')
expect(result.settings.download_dir).to.be.null
})
it(`update model and click 'add' should raise add-topic event correct model`, async function () {
const vm = new Constructor().$mount()
const addTopicEventFinished = new Promise(resolve => vm.$on('add-topic', resolve))
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
const supportedDefaultClientResult = {...defaultClientResult, ...{fields: {download_dir: '/path/to/dir'}, name: 'transmission'}}
createDefaultClientStub(supportedDefaultClientResult)
createParseUrlStub()
const parseUrlSpy = sandbox.spy(vm, 'parseUrl')
await vm.open()
await Vue.nextTick()
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
await Vue.nextTick()
await parseUrlSpy.lastCall.returnValue
expect(vm.complete).to.be.ok
await Vue.nextTick()
vm.$refs.dynamicForm.model.display_name = 'Taboo'
vm.$refs.dynamicForm.model.quality = '1080p'
vm.additionalFields.downloadDir.path = '/path/to/dir/custom'
await Vue.nextTick()
vm.$refs.add.$el.click()
await Vue.nextTick()
const raiseIn10ms = wait(10).then(() => { throw new Error('Event was not executed') })
await Promise.race([addTopicEventFinished, raiseIn10ms])
const result = await addTopicEventFinished
expect(result.url).to.be.equal(url)
expect(result.settings.display_name).to.be.equal('Taboo')
expect(result.settings.quality).to.be.equal('1080p')
expect(result.settings.download_dir).to.be.equal('/path/to/dir/custom')
})
it(`update model without download_dir and click 'add' should raise add-topic event correct model`, async function () {
const vm = new Constructor().$mount()
const addTopicEventFinished = new Promise(resolve => vm.$on('add-topic', resolve))
await Vue.nextTick()
expect(vm.$refs.addTopicDialog).to.be.ok
const supportedDefaultClientResult = {...defaultClientResult, ...{fields: {download_dir: '/path/to/dir'}, name: 'transmission'}}
createDefaultClientStub(supportedDefaultClientResult)
createParseUrlStub()
const parseUrlSpy = sandbox.spy(vm, 'parseUrl')
await vm.open()
await Vue.nextTick()
const url = 'https://lostfilm.tv/series/TV_Show/seasons'
vm.topic.url = url
await Vue.nextTick()
await parseUrlSpy.lastCall.returnValue
expect(vm.complete).to.be.ok
await Vue.nextTick()
vm.$refs.dynamicForm.model.display_name = 'Taboo'
vm.$refs.dynamicForm.model.quality = '1080p'
await Vue.nextTick()
vm.$refs.add.$el.click()
await Vue.nextTick()
const raiseIn10ms = wait(10).then(() => { throw new Error('Event was not executed') })
await Promise.race([addTopicEventFinished, raiseIn10ms])
const result = await addTopicEventFinished
expect(result.url).to.be.equal(url)
expect(result.settings.display_name).to.be.equal('Taboo')
expect(result.settings.quality).to.be.equal('1080p')
expect(result.settings.download_dir).to.be.null
})
it(`show dialog on openEdit with disabled url input`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
const getTopicStub = createGetTopicStub()
const defaultClientStub = createDefaultClientStub()
await vm.openEdit(12)
await Vue.nextTick()
expect(vm.mode).to.be.equal('edit')
expect(vm.topic.id).to.be.equal(12)
expect(vm.topic.error).to.be.null
expect(vm.topic.url).to.be.equal(parseUrlResult.url)
expect(vm.topic.loading).to.be.false
expect(defaultClientStub).have.been.calledOnce
expect(getTopicStub).have.been.calledOnce
expect(getTopicStub).have.been.calledWith(12)
expect(vm.$refs.title.$el.href).to.be.equal(parseUrlResult.url)
expect(vm.$refs.title.$el.textContent).to.contain('Edit').and.not.contain('Add')
expect(vm.$refs.topicUrlInput.$el.disabled).to.be.true
})
it(`show dialog on openEdit and raise edit-topic on save button click`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
const getTopicStub = createGetTopicStub()
const defaultClientStub = createDefaultClientStub()
await vm.openEdit(12)
await Vue.nextTick()
expect(vm.mode).to.be.equal('edit')
expect(vm.topic.id).to.be.equal(12)
expect(vm.topic.error).to.be.null
expect(vm.topic.url).to.be.equal(parseUrlResult.url)
expect(vm.topic.loading).to.be.false
expect(defaultClientStub).have.been.calledOnce
expect(getTopicStub).have.been.calledOnce
expect(getTopicStub).have.been.calledWith(12)
expect(vm.$refs.title.$el.href).to.be.equal(parseUrlResult.url)
expect(vm.$refs.title.$el.textContent).to.contain('Edit').and.not.contain('Add')
expect(vm.$refs.topicUrlInput.$el.disabled).to.be.true
const editTopicEventFinished = new Promise(resolve => vm.$on('edit-topic', resolve))
vm.$refs.save.$el.click()
await Vue.nextTick()
const raiseIn10ms = wait(10).then(() => { throw new Error('Event was not executed') })
await Promise.race([editTopicEventFinished, raiseIn10ms])
})
it(`show dialog with error on openEdit when getTopic failed`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
const error = new Error('Some error')
const getTopicStub = sandbox.stub(api.default, 'getTopic', () => new Promise((resolve, reject) => setTimeout(() => reject(error))))
const defaultClientStub = createDefaultClientStub()
const consoleErrorStub = sandbox.stub(console, 'error')
await vm.openEdit(12)
await Vue.nextTick()
expect(vm.mode).to.be.equal('edit')
expect(vm.topic.id).to.be.equal(12)
expect(vm.topic.error).to.be.equal(error.toString())
expect(vm.topic.loading).to.be.false
expect(vm.$refs.title.$el.href).to.be.equal(parseUrlResult.url)
expect(vm.$refs.title.$el.textContent).to.contain('Edit').and.not.contain('Add')
expect(vm.$refs.topicUrlInput.$el.disabled).to.be.true
expect(defaultClientStub).have.not.been.called
expect(getTopicStub).have.been.calledOnce
expect(getTopicStub).have.been.calledWith(12)
expect(consoleErrorStub).have.been.calledOnce
expect(consoleErrorStub).have.been.calledWith(error)
})
it(`show loading on openEdit`, async function () {
const vm = new Constructor().$mount()
await Vue.nextTick()
const getTopicDefered = new Deferred()
const getTopicStub = sandbox.stub(api.default, 'getTopic', () => getTopicDefered.promise)
const defaultClientStub = createDefaultClientStub()
const openEditPromise = vm.openEdit(12)
await Vue.nextTick()
expect(vm.mode).to.be.equal('edit')
expect(vm.topic.id).to.be.equal(12)
expect(vm.topic.error).to.be.null
expect(vm.topic.url).to.be.null
expect(vm.topic.loading).to.be.true
expect(vm.$refs.topicProgress.$el.style.opacity).to.equal('1')
expect(vm.$refs.add).to.be.not.ok
expect(vm.$refs.save).to.be.ok
getTopicDefered.resolve(parseUrlResult)
await openEditPromise
await Vue.nextTick()
expect(vm.topic.url).to.be.equal(parseUrlResult.url)
expect(vm.topic.loading).to.be.false
expect(vm.$refs.topicProgress.$el.style.opacity).to.equal('0')
expect(defaultClientStub).have.been.calledOnce
expect(getTopicStub).have.been.calledOnce
expect(getTopicStub).have.been.calledWith(12)
})
})