Skip to content

Commit

Permalink
test: add ignore utility test (#25891)
Browse files Browse the repository at this point in the history
  • Loading branch information
ImBIOS committed Nov 21, 2023
1 parent 3c65681 commit d4db499
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions lib/util/ignore.spec.ts
@@ -0,0 +1,33 @@
import { logger } from '../logger';
import { isSkipComment } from './ignore';

jest.mock('../logger', () => ({
logger: {
debug: jest.fn(),
},
}));

describe('util/ignore', () => {
it('returns true for "renovate:ignore" comments', () => {
expect(isSkipComment('renovate:ignore')).toBe(true);
});

it('returns false for comments not starting with "renovate:" or "pyup:"', () => {
expect(isSkipComment('other:ignore')).toBe(false);
});

it('returns false for "renovate:" comments without "ignore"', () => {
expect(isSkipComment('renovate:update')).toBe(false);
});

it('logs unknown command for "renovate:" comments without "ignore"', () => {
isSkipComment('renovate:update');
expect(logger.debug).toHaveBeenCalledWith(
'Unknown comment command: update',
);
});

it('returns false when comment is undefined', () => {
expect(isSkipComment()).toBe(false);
});
});

0 comments on commit d4db499

Please sign in to comment.