-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathatom-phpunit-view-spec.js
58 lines (32 loc) · 1.38 KB
/
atom-phpunit-view-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
'use babel';
import fs from 'fs';
import AtomPhpunitView from '../lib/atom-phpunit-view';
const fixtures = {
pass: fs.readFileSync(require.resolve('./fixtures/phpunit_output_passing.txt')).toString(),
fail: fs.readFileSync(require.resolve('./fixtures/phpunit_output_failing.txt')).toString(),
};
describe('atom-phpunit-view', () => {
let view = new AtomPhpunitView;
describe('cleans the phpunit output', () => {
it('from passing tests', () => {
expect(view.getCleanOutput(fixtures.pass)).not.toMatch(/PHPUnit/)
expect(view.getCleanOutput(fixtures.pass)).not.toMatch(/OK/)
})
it('from failing tests', () => {
expect(view.getCleanOutput(fixtures.fail)).not.toMatch(/PHPUnit/)
expect(view.getCleanOutput(fixtures.fail)).not.toMatch(/Failures/)
})
})
describe('creates an updated header', () => {
let command = 'vendor/bin/phpunit'
it('for passing tests', () => {
expect(view.getUpdatedHeader(fixtures.pass,command)).toMatch(/OK/)
})
it('for failing tests', () => {
expect(view.getUpdatedHeader(fixtures.fail,command)).toMatch(/Failures: 1/)
})
it('for unrecognized output', () => {
expect(view.getUpdatedHeader('this is unrecognized output',command)).toMatch(/PHPUnit Output/)
})
})
});