This repository was archived by the owner on Sep 21, 2022. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathstate.js
More file actions
83 lines (62 loc) · 2.37 KB
/
Copy pathstate.js
File metadata and controls
83 lines (62 loc) · 2.37 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
'use strict';
const State = require('lib/state');
const util = require('../util');
describe('state methods', () => {
describe('shouldSkip', () => {
it('should check if state will be skipped', () => {
const suite = util.makeSuiteStub();
suite.shouldSkip = sinon.stub();
suite.shouldSkip.withArgs('browserId').returns(true);
const state = new State(suite);
assert.isTrue(state.shouldSkip('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);
});
});
});