1
|
|
|
/* eslint-env mocha */ |
2
|
|
|
/* eslint-disable no-unused-expressions */ |
3
|
|
|
|
4
|
|
|
var Sinon = require('sinon') |
5
|
|
|
var Chai = require('chai') |
6
|
|
|
var expect = Chai.expect |
7
|
|
|
|
8
|
|
|
var VoxEngine = require('../../../../lib/Stub/VoxEngine').VoxEngine |
9
|
|
|
|
10
|
|
|
describe('Acceptance', function () { |
11
|
|
|
describe('/Stub', function () { |
12
|
|
|
describe('/VoxEngine.js', function () { |
13
|
|
|
describe('.Logger', function () { |
14
|
|
|
var instance |
15
|
|
|
var allure |
16
|
|
|
|
17
|
|
|
beforeEach(function () { |
18
|
|
|
allure = global.allure |
19
|
|
|
global.allure = { |
20
|
|
|
createAttachment: Sinon.stub() |
21
|
|
|
} |
22
|
|
|
instance = new VoxEngine() |
23
|
|
|
}) |
24
|
|
|
|
25
|
|
|
afterEach(function () { |
26
|
|
|
global.allure = allure |
27
|
|
|
}) |
28
|
|
|
|
29
|
|
|
describe('#customData()', function () { |
30
|
|
|
it('writes data into `._state` and retrieves it', function () { |
31
|
|
|
expect(instance._state.customData).to.be.not.ok |
32
|
|
|
var value = 'wow' |
33
|
|
|
instance.customData(value) |
34
|
|
|
expect(instance._state.customData).to.eq(value) |
35
|
|
|
expect(instance.customData()).to.eq(value) |
36
|
|
|
}) |
37
|
|
|
}) |
38
|
|
|
|
39
|
|
|
describe('#_flush()', function () { |
40
|
|
|
it('doesn\'t save allure attachments if it is disabled', function () { |
41
|
|
|
instance = new VoxEngine({allure: {enabled: false}}) |
42
|
|
|
instance.customData('wow') |
43
|
|
|
instance._flush() |
44
|
|
|
expect(global.allure.createAttachment.callCount).to.eq(0) |
45
|
|
|
}) |
46
|
|
|
|
47
|
|
|
it('doesn\'t save allure attachments if it is missing', function () { |
48
|
|
|
global.allure = null |
49
|
|
|
instance.customData('wow') |
50
|
|
|
expect(instance._flush).not.to.throw() |
51
|
|
|
}) |
52
|
|
|
}) |
53
|
|
|
}) |
54
|
|
|
}) |
55
|
|
|
}) |
56
|
|
|
}) |
57
|
|
|
|