ui5-test-runner 4.0.0 → 4.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,63 +0,0 @@
1
- const { join } = require('path')
2
- const { getOutput } = require('./output')
3
- const jobFactory = require('./job')
4
- const mappingFactory = require('./unhandled')
5
-
6
- const cwd = join(__dirname, '../test/project')
7
-
8
- describe('src/unhandled', () => {
9
- let unhandled
10
- let output
11
- let unhandledCall
12
-
13
- beforeEach(() => {
14
- const job = jobFactory.fromCmdLine(cwd, [])
15
- output = getOutput(job)
16
- unhandledCall = 0
17
- output.unhandled = () => {
18
- ++unhandledCall
19
- }
20
- unhandled = mappingFactory(job)[0].custom
21
- })
22
-
23
- const expectedIgnores = [
24
- 'favicon.ico',
25
- 'component-preload.js',
26
- 'button-dbg.js',
27
- 'i18n_en.properties'
28
- ]
29
- expectedIgnores.forEach(url => {
30
- it(`does not log known GET patterns (${url})`, () => {
31
- expect(unhandled({ method: 'GET', url })).toStrictEqual(404)
32
- expect(unhandledCall).toStrictEqual(0)
33
- })
34
- })
35
-
36
- const expectedWarnings = [
37
- 'any-mock-data-file.json',
38
- 'sourceFile.js'
39
- ]
40
- expectedWarnings.forEach(url => {
41
- it(`warns about 404 GET (${url})`, () => {
42
- expect(unhandled({ method: 'GET', url, headers: { referer: 'http://localhost:3475/test.html' } })).toStrictEqual(404)
43
- expect(unhandledCall).toStrictEqual(1)
44
- })
45
- })
46
- it('Warns only once', () => {
47
- expectedWarnings.forEach(url => {
48
- expect(unhandled({ method: 'GET', url, headers: { referer: 'http://localhost:3475/test.html' } })).toStrictEqual(404)
49
- })
50
- expect(unhandledCall).toStrictEqual(1)
51
- })
52
-
53
- it('logs errors for any other verb', () => {
54
- expect(unhandled({ method: 'POST', url: '/any_url', headers: { referer: 'http://localhost:3475/test.html' } })).toStrictEqual(500)
55
- expect(unhandledCall).toStrictEqual(1)
56
- })
57
-
58
- it('logs errors only once', () => {
59
- expect(unhandled({ method: 'POST', url: '/any_url', headers: { referer: 'http://localhost:3475/test.html' } })).toStrictEqual(500)
60
- expect(unhandled({ method: 'POST', url: '/any_other_url', headers: { referer: 'http://localhost:3475/test.html' } })).toStrictEqual(500)
61
- expect(unhandledCall).toStrictEqual(1)
62
- })
63
- })