|
1 | | -const phplint = require('./phplint'); |
| 1 | +const phplint = require("./phplint"); |
2 | 2 |
|
3 | | -test('it returns defaults', () => { |
4 | | - expect(phplint({}, 'web')).toEqual(['phplint', '--exclude=vendor', '--exclude=web/core', '--exclude=web/modules/contrib', '--extensions=php', '--extensions=module', '--extensions=theme', '--extensions=engine', '--extensions=inc', '--extensions=install']); |
| 3 | +test("it returns defaults", () => { |
| 4 | + expect(phplint({}, "web")).toEqual([ |
| 5 | + "phplint", |
| 6 | + "--exclude=vendor", |
| 7 | + "--exclude=web/core", |
| 8 | + "--exclude=web/modules/contrib", |
| 9 | + "--extensions=php", |
| 10 | + "--extensions=module", |
| 11 | + "--extensions=theme", |
| 12 | + "--extensions=engine", |
| 13 | + "--extensions=inc", |
| 14 | + "--extensions=install", |
| 15 | + ]); |
5 | 16 | }); |
6 | 17 |
|
7 | | -test('it returns no options', () => { |
8 | | - expect(phplint({ no_default_options: true }, 'web')).toEqual(['phplint']); |
9 | | - expect(phplint({ |
10 | | - no_default_options: true, |
11 | | - exclude: 'vendor', |
12 | | - }, 'web')).toEqual(['phplint']); |
| 18 | +test("it returns no options", () => { |
| 19 | + expect(phplint({ no_default_options: true }, "web")).toEqual(["phplint"]); |
| 20 | + expect( |
| 21 | + phplint( |
| 22 | + { |
| 23 | + no_default_options: true, |
| 24 | + exclude: "vendor", |
| 25 | + }, |
| 26 | + "web" |
| 27 | + ) |
| 28 | + ).toEqual(["phplint"]); |
13 | 29 | }); |
14 | 30 |
|
15 | | -test('it handles partial inputs', () => { |
| 31 | +test("it handles partial inputs", () => { |
16 | 32 | let command; |
17 | | - command = phplint({ |
18 | | - exclude: 'vendor,web/themes/contrib', |
19 | | - }, 'web'); |
20 | | - expect(command).toContain('--exclude=vendor'); |
21 | | - expect(command).toContain('--exclude=web/themes/contrib'); |
22 | | - expect(command).not.toContain('--exclude=web/modules/contrib'); |
| 33 | + command = phplint( |
| 34 | + { |
| 35 | + exclude: "vendor,web/themes/contrib", |
| 36 | + }, |
| 37 | + "web" |
| 38 | + ); |
| 39 | + expect(command).toContain("--exclude=vendor"); |
| 40 | + expect(command).toContain("--exclude=web/themes/contrib"); |
| 41 | + expect(command).not.toContain("--exclude=web/modules/contrib"); |
23 | 42 |
|
24 | | - command = phplint({ |
25 | | - extensions: 'php,inc', |
26 | | - }, 'docroot'); |
27 | | - expect(command).toContain('--extensions=php'); |
28 | | - expect(command).toContain('--extensions=inc'); |
29 | | - expect(command).not.toContain('--extensions=module'); |
30 | | - expect(command).toContain('--exclude=docroot/modules/contrib'); |
| 43 | + command = phplint( |
| 44 | + { |
| 45 | + extensions: "php,inc", |
| 46 | + }, |
| 47 | + "docroot" |
| 48 | + ); |
| 49 | + expect(command).toContain("--extensions=php"); |
| 50 | + expect(command).toContain("--extensions=inc"); |
| 51 | + expect(command).not.toContain("--extensions=module"); |
| 52 | + expect(command).toContain("--exclude=docroot/modules/contrib"); |
31 | 53 |
|
32 | | - command = phplint({ |
33 | | - verbose: true, |
34 | | - path: 'web/modules/custom', |
35 | | - }, 'docroot'); |
36 | | - expect(command).toContain('-v'); |
37 | | - expect(command).toContain('--exclude=docroot/modules/contrib'); |
38 | | - expect(command).toContain('web/modules/custom'); |
| 54 | + command = phplint( |
| 55 | + { |
| 56 | + verbose: true, |
| 57 | + path: "web/modules/custom", |
| 58 | + }, |
| 59 | + "docroot" |
| 60 | + ); |
| 61 | + expect(command).toContain("-v"); |
| 62 | + expect(command).toContain("--exclude=docroot/modules/contrib"); |
| 63 | + expect(command).toContain("web/modules/custom"); |
39 | 64 | }); |
0 commit comments