|
1 | 1 | import { describe, expect, it } from 'vitest'; |
2 | 2 | import { |
3 | 3 | artifactGenerationCommand, |
4 | | - pluginArtefactOptionsSchema, |
| 4 | + pluginArtifactOptionsSchema, |
5 | 5 | } from './configuration.js'; |
6 | 6 |
|
7 | 7 | describe('artifactGenerationCommand', () => { |
@@ -37,61 +37,61 @@ describe('artifactGenerationCommand', () => { |
37 | 37 | }); |
38 | 38 | }); |
39 | 39 |
|
40 | | -describe('pluginArtefactOptionsSchema', () => { |
41 | | - it('should validate with only artefactsPaths as string', () => { |
42 | | - const data = { artefactsPaths: 'dist/report.json' }; |
43 | | - expect(pluginArtefactOptionsSchema.safeParse(data)).toStrictEqual({ |
| 40 | +describe('pluginArtifactOptionsSchema', () => { |
| 41 | + it('should validate with only artifactsPaths as string', () => { |
| 42 | + const data = { artifactsPaths: 'dist/report.json' }; |
| 43 | + expect(pluginArtifactOptionsSchema.safeParse(data)).toStrictEqual({ |
44 | 44 | success: true, |
45 | 45 | data: { |
46 | | - artefactsPaths: 'dist/report.json', |
| 46 | + artifactsPaths: 'dist/report.json', |
47 | 47 | }, |
48 | 48 | }); |
49 | 49 | }); |
50 | 50 |
|
51 | | - it('should validate with artefactsPaths as array of strings', () => { |
52 | | - const data = { artefactsPaths: ['dist/report.json', 'dist/summary.json'] }; |
53 | | - expect(pluginArtefactOptionsSchema.safeParse(data)).toStrictEqual({ |
| 51 | + it('should validate with artifactsPaths as array of strings', () => { |
| 52 | + const data = { artifactsPaths: ['dist/report.json', 'dist/summary.json'] }; |
| 53 | + expect(pluginArtifactOptionsSchema.safeParse(data)).toStrictEqual({ |
54 | 54 | success: true, |
55 | 55 | data: { |
56 | | - artefactsPaths: ['dist/report.json', 'dist/summary.json'], |
| 56 | + artifactsPaths: ['dist/report.json', 'dist/summary.json'], |
57 | 57 | }, |
58 | 58 | }); |
59 | 59 | }); |
60 | 60 |
|
61 | | - it('should fail if artefactsPaths is an empty array', () => { |
62 | | - const data = { artefactsPaths: [] }; |
63 | | - expect(pluginArtefactOptionsSchema.safeParse(data).success).toBe(false); |
| 61 | + it('should fail if artifactsPaths is an empty array', () => { |
| 62 | + const data = { artifactsPaths: [] }; |
| 63 | + expect(pluginArtifactOptionsSchema.safeParse(data).success).toBe(false); |
64 | 64 | }); |
65 | 65 |
|
66 | | - it('should validate with generateArtefacts and artefactsPaths', () => { |
| 66 | + it('should validate with generateArtifacts and artifactsPaths', () => { |
67 | 67 | const data = { |
68 | | - generateArtefacts: { command: 'npm', args: ['run', 'build'] }, |
69 | | - artefactsPaths: ['dist/report.json'], |
| 68 | + generateArtifacts: { command: 'npm', args: ['run', 'build'] }, |
| 69 | + artifactsPaths: ['dist/report.json'], |
70 | 70 | }; |
71 | | - expect(pluginArtefactOptionsSchema.safeParse(data)).toStrictEqual({ |
| 71 | + expect(pluginArtifactOptionsSchema.safeParse(data)).toStrictEqual({ |
72 | 72 | success: true, |
73 | 73 | data: { |
74 | | - generateArtefacts: { command: 'npm', args: ['run', 'build'] }, |
75 | | - artefactsPaths: ['dist/report.json'], |
| 74 | + generateArtifacts: { command: 'npm', args: ['run', 'build'] }, |
| 75 | + artifactsPaths: ['dist/report.json'], |
76 | 76 | }, |
77 | 77 | }); |
78 | 78 | }); |
79 | 79 |
|
80 | | - it('should fail if artefactsPaths is missing', () => { |
81 | | - const data = { generateArtefacts: { command: 'npm' } }; |
82 | | - expect(pluginArtefactOptionsSchema.safeParse(data).success).toBe(false); |
| 80 | + it('should fail if artifactsPaths is missing', () => { |
| 81 | + const data = { generateArtifacts: { command: 'npm' } }; |
| 82 | + expect(pluginArtifactOptionsSchema.safeParse(data).success).toBe(false); |
83 | 83 | }); |
84 | 84 |
|
85 | | - it('should fail if artefactsPaths is not string or array of strings', () => { |
86 | | - const data = { artefactsPaths: 123 }; |
87 | | - expect(pluginArtefactOptionsSchema.safeParse(data).success).toBe(false); |
| 85 | + it('should fail if artifactsPaths is not string or array of strings', () => { |
| 86 | + const data = { artifactsPaths: 123 }; |
| 87 | + expect(pluginArtifactOptionsSchema.safeParse(data).success).toBe(false); |
88 | 88 | }); |
89 | 89 |
|
90 | | - it('should fail if generateArtefacts is invalid', () => { |
| 90 | + it('should fail if generateArtifacts is invalid', () => { |
91 | 91 | const data = { |
92 | | - generateArtefacts: { command: '' }, |
93 | | - artefactsPaths: 'dist/report.json', |
| 92 | + generateArtifacts: { command: '' }, |
| 93 | + artifactsPaths: 'dist/report.json', |
94 | 94 | }; |
95 | | - expect(pluginArtefactOptionsSchema.safeParse(data).success).toBe(false); |
| 95 | + expect(pluginArtifactOptionsSchema.safeParse(data).success).toBe(false); |
96 | 96 | }); |
97 | 97 | }); |
0 commit comments