Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions @commitlint/ensure/src/enum.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ test('false for no params', () => {
expect(actual).toBe(false);
});

test('false for not array enums', () => {
const actual = ensure('a', 'a' as any);
expect(actual).toBe(false);
});

test('true for a against a', () => {
const actual = ensure('a', ['a']);
expect(actual).toBe(true);
Expand Down
11 changes: 10 additions & 1 deletion @commitlint/is-ignored/src/is-ignored.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ test('should throw error if ignores is not an array', () => {
isIgnored(ignoredString, {
ignores: 'throws error'
} as any);
}).toThrow();
}).toThrow('ignores must be of type array, received ');
});

test('should return true for custom ignores as function', () => {
Expand All @@ -161,3 +161,12 @@ test('should return true for custom ignores as function', () => {
})
).toBe(true);
});

test('should throw error if any element of ignores is not a function', () => {
const ignoredString = 'this should be ignored';
expect(() => {
isIgnored(ignoredString, {
ignores: ['throws error']
} as any);
}).toThrow('ignores must be array of type function, received items of type:');
});