Skip to content

Commit f3e827f

Browse files
refactor: specs and comment (#104)
Co-authored-by: Almanov Nikita <[email protected]>
1 parent c3b0f2f commit f3e827f

File tree

2 files changed

+29
-157
lines changed

2 files changed

+29
-157
lines changed

specs/define-config.spec.ts

Lines changed: 28 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,22 @@ import { defineConfig } from '#index';
55
import type { UserConfig } from '@commitlint/types';
66

77
describe('Commitlint Config', async () => {
8+
const generateEnum = async () => ({
9+
customProperty: {
10+
description: '',
11+
title: '',
12+
emoji: '',
13+
},
14+
});
15+
16+
const promptQuestions = async () => ({
17+
description: '',
18+
messages: {
19+
customMessage: '',
20+
},
21+
enum: await generateEnum(),
22+
});
23+
824
spec('should return empty config', async () => {
925
expectTypeOf(defineConfig({})).toEqualTypeOf<UserConfig>();
1026
});
@@ -42,162 +58,18 @@ describe('Commitlint Config', async () => {
4258
scopeEnumSeparator: '',
4359
},
4460
questions: {
45-
header: {
46-
description: '',
47-
messages: {
48-
customMessage: '',
49-
},
50-
enum: {
51-
customProperty: {
52-
description: '',
53-
title: '',
54-
emoji: '',
55-
},
56-
},
57-
},
58-
type: {
59-
description: '',
60-
messages: {
61-
customMessage: '',
62-
},
63-
enum: {
64-
customProperty: {
65-
description: '',
66-
title: '',
67-
emoji: '',
68-
},
69-
},
70-
},
71-
scope: {
72-
description: '',
73-
messages: {
74-
customMessage: '',
75-
},
76-
enum: {
77-
customProperty: {
78-
description: '',
79-
title: '',
80-
emoji: '',
81-
},
82-
},
83-
},
84-
subject: {
85-
description: '',
86-
messages: {
87-
customMessage: '',
88-
},
89-
enum: {
90-
customProperty: {
91-
description: '',
92-
title: '',
93-
emoji: '',
94-
},
95-
},
96-
},
97-
body: {
98-
description: '',
99-
messages: {
100-
customMessage: '',
101-
},
102-
enum: {
103-
customProperty: {
104-
description: '',
105-
title: '',
106-
emoji: '',
107-
},
108-
},
109-
},
110-
footer: {
111-
description: '',
112-
messages: {
113-
customMessage: '',
114-
},
115-
enum: {
116-
customProperty: {
117-
description: '',
118-
title: '',
119-
emoji: '',
120-
},
121-
},
122-
},
123-
isBreaking: {
124-
description: '',
125-
messages: {
126-
customMessage: '',
127-
},
128-
enum: {
129-
customProperty: {
130-
description: '',
131-
title: '',
132-
emoji: '',
133-
},
134-
},
135-
},
136-
breakingBody: {
137-
description: '',
138-
messages: {
139-
customMessage: '',
140-
},
141-
enum: {
142-
customProperty: {
143-
description: '',
144-
title: '',
145-
emoji: '',
146-
},
147-
},
148-
},
149-
breaking: {
150-
description: '',
151-
messages: {
152-
customMessage: '',
153-
},
154-
enum: {
155-
customProperty: {
156-
description: '',
157-
title: '',
158-
emoji: '',
159-
},
160-
},
161-
},
162-
isIssueAffected: {
163-
description: '',
164-
messages: {
165-
customMessage: '',
166-
},
167-
enum: {
168-
customProperty: {
169-
description: '',
170-
title: '',
171-
emoji: '',
172-
},
173-
},
174-
},
175-
issuesBody: {
176-
description: '',
177-
messages: {
178-
customMessage: '',
179-
},
180-
enum: {
181-
customProperty: {
182-
description: '',
183-
title: '',
184-
emoji: '',
185-
},
186-
},
187-
},
188-
issues: {
189-
description: '',
190-
messages: {
191-
customMessage: '',
192-
},
193-
enum: {
194-
customProperty: {
195-
description: '',
196-
title: '',
197-
emoji: '',
198-
},
199-
},
200-
},
61+
body: await promptQuestions(),
62+
breaking: await promptQuestions(),
63+
breakingBody: await promptQuestions(),
64+
footer: await promptQuestions(),
65+
header: await promptQuestions(),
66+
isBreaking: await promptQuestions(),
67+
isIssueAffected: await promptQuestions(),
68+
issues: await promptQuestions(),
69+
issuesBody: await promptQuestions(),
70+
scope: await promptQuestions(),
71+
subject: await promptQuestions(),
72+
type: await promptQuestions(),
20173
},
20274
},
20375
rules: {},

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { UserConfig } from '@commitlint/types';
55
*
66
* @param {object} config Commitlint.
77
*
8-
* @returns Commitlint config.
8+
* @return Commitlint config.
99
*/
1010
const defineConfig = (config: UserConfig): UserConfig => config;
1111

0 commit comments

Comments
 (0)