Repository navigation
Expand file tree
/
Copy pathstate.js
More file actions
85 lines (63 loc) · 2.43 KB
/
Copy pathstate.js
File metadata and controls
85 lines (63 loc) · 2.43 KB
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
'use strict';
const State = require('lib/state');
const util = require('../util');
const suiteUtil = require('lib/suite-util');
describe('state methods', () => {
describe('shouldSkip', () => {
it('should check if state will be skipped', () => {
const suite = util.makeSuiteStub();
const state = new State(suite);
sinon.stub(suiteUtil, 'shouldSkip').returns(true);
state.shouldSkip('browserId');
assert.calledWithMatch(suiteUtil.shouldSkip, suite, 'browserId');
});
});
describe('tolerance', () => {
let suite, state;
beforeEach(() => {
suite = util.makeSuiteStub();
state = new State(suite);
});
it('should set tolerance for the current state', () => {
state.tolerance = 100;
assert.equal(state.tolerance, 100);
});
it('should use suite tolerance value if it was not set for a state', () => {
suite.tolerance = 1;
assert.equal(state.tolerance, 1);
});
});
it('should return state fullName', () => {
const suite = util.makeSuiteStub({name: 'suite-name'});
const state = new State(suite, 'plain');
assert.equal(state.fullName, 'suite-name plain');
});
['skipped', 'captureSelectors', 'ignoreSelectors'].forEach((method) => {
it(`should return suite ${method} value`, () => {
const suite = util.makeSuiteStub();
suite[method] = 'value';
const state = new State(suite);
assert.equal(state[method], suite[method]);
});
});
describe('clone method', () => {
it('should return cloned state', () => {
const state = new State({});
const clonedState = state.clone();
assert.notEqual(state, clonedState);
});
it('should clone actions from the origin state', () => {
const state = new State({});
state.actions.push('actions');
const clonedState = state.clone();
state.actions.push('anotherAction');
assert.deepEqual(clonedState.actions, ['actions']);
});
it('should clone tolerance from the origin state', () => {
const state = new State({});
state.tolerance = 100;
const clonedState = state.clone();
assert.equal(clonedState.tolerance, 100);
});
});
});