Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove keywords if they're not present #2474

Merged
merged 5 commits into from
Jul 10, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions utils/__tests__/validate_icon.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ import * as fs from 'fs';
import { validateIcon, handleErrors } from '../validate_icons';

jest.mock('fs');
const exitMock = jest.spyOn(process, 'exit').mockImplementation(() => {});

describe('validate Icon tests', () => {
afterEach(() => {
jest.restoreAllMocks();
jest.resetAllMocks();
});

describe('validateIcon', () => {
Expand Down Expand Up @@ -130,7 +131,7 @@ describe('validate Icon tests', () => {
expect(logMock).toHaveBeenCalledWith(
'No errors found. Icon validation passed.'
);
expect(process.exitCode).toBe(undefined);
expect(exitMock).not.toHaveBeenCalled();
});

test('when given errors, prints each error and sets exitCode to 1', () => {
Expand All @@ -139,7 +140,7 @@ describe('validate Icon tests', () => {
handleErrors(['error1', 'error2', 'error3', 'error4']);

expect(logMock).toBeCalledTimes(4);
expect(process.exitCode).toBe(1);
expect(exitMock).toHaveBeenCalledWith(1);
});
});
});
4 changes: 2 additions & 2 deletions utils/validate_icons.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@ export const handleErrors = (
}

if (errorMessages.length > 0) {
process.exitCode = 1; // fail the workflow

for (const errorMessage of errorMessages) {
console.log(errorMessage);
}

process.exit(1);
d3caf marked this conversation as resolved.
Show resolved Hide resolved
}
};

Expand Down
Loading