Skip to content

Commit 3774052

Browse files
committed
refactor(test/when): adapt with dependencies upgrade
1 parent 764bd86 commit 3774052

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

src/when.test.ts

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { Level, Rule } from '@commitlint/load';
1+
import type { RuleConfigTuple } from '@commitlint/types';
2+
import { RuleConfigSeverity } from '@commitlint/types';
23
import { emptyWhen, enumWhen, whenFactory } from './when';
34

45
describe('when', () => {
@@ -10,25 +11,25 @@ describe('when', () => {
1011
});
1112

1213
test('should return true if level is disable', () => {
13-
const result = enumWhen([Level.Disable, 'always', []]);
14+
const result = enumWhen([RuleConfigSeverity.Disabled, 'always', []]);
1415

1516
expect(result).toBe(true);
1617
});
1718

1819
test('should return true if applicable is never', () => {
19-
const result = enumWhen([Level.Error, 'never', []]);
20+
const result = enumWhen([RuleConfigSeverity.Error, 'never', []]);
2021

2122
expect(result).toBe(true);
2223
});
2324

2425
test('should return true when array not empty', () => {
25-
const result = enumWhen([Level.Error, 'always', ['foo']]);
26+
const result = enumWhen([RuleConfigSeverity.Error, 'always', ['foo']]);
2627

2728
expect(result).toBe(true);
2829
});
2930

3031
test('should return false when array empty', () => {
31-
const result = enumWhen([Level.Error, 'always', []]);
32+
const result = enumWhen([RuleConfigSeverity.Error, 'always', []]);
3233

3334
expect(result).toBe(false);
3435
});
@@ -42,29 +43,29 @@ describe('when', () => {
4243
});
4344

4445
test('should return true if level is disable', () => {
45-
const result = emptyWhen([Level.Disable, 'always', undefined]);
46+
const result = emptyWhen([RuleConfigSeverity.Disabled, 'always']);
4647

4748
expect(result).toBe(true);
4849
});
4950

5051
test('should return true if applicable is never', () => {
51-
const result = emptyWhen([Level.Error, 'never', undefined]);
52+
const result = emptyWhen([RuleConfigSeverity.Error, 'never']);
5253

5354
expect(result).toBe(true);
5455
});
5556

5657
test('should return false if applicable is always', () => {
57-
const result = emptyWhen([Level.Error, 'always', undefined]);
58+
const result = emptyWhen([RuleConfigSeverity.Error, 'always']);
5859

5960
expect(result).toBe(false);
6061
});
6162
});
6263

6364
describe('whenFactory', () => {
64-
const hidePromptEnumRule: Rule<string[]> | undefined = [Level.Error, 'always', []];
65-
const hidePromptEmptyRule: Rule<undefined> | undefined = [Level.Error, 'always', undefined];
65+
const hidePromptEnumRule: RuleConfigTuple<string[]> | undefined = [RuleConfigSeverity.Error, 'always', []];
66+
const hidePromptEmptyRule: RuleConfigTuple<undefined> | undefined = [RuleConfigSeverity.Error, 'always'];
6667

67-
test.each<[Rule<string[]> | undefined, Rule<undefined> | undefined, boolean]>([
68+
test.each<[RuleConfigTuple<string[]> | undefined, RuleConfigTuple<undefined> | undefined, boolean]>([
6869
[undefined, undefined, true],
6970
[undefined, hidePromptEmptyRule, false],
7071
[hidePromptEnumRule, undefined, false],

0 commit comments

Comments
 (0)