Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pam- committed Mar 2, 2021
1 parent 3ce992c commit 7a7ca58
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
7 changes: 4 additions & 3 deletions __tests__/utils.spec.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { formatChannelName, buildSlackAttachments } from '../src/utils';
import { GITHUB_PUSH_EVENT, GITHUB_PR_EVENT } from '../fixtures';
const runId = parseInt(process.env.GITHUB_RUN_ID, 10);

describe('Utils', () => {
describe('formatChannelName', () => {
Expand Down Expand Up @@ -35,7 +36,7 @@ describe('Utils', () => {

expect(attachments[0].fields.find(a => a.title === 'Workflow')).toEqual({
title: 'Workflow',
value: `<https://github.com/voxmedia/github-action-slack-notify-build/actions/runs/${process.env.GITHUB_JOB} | CI>`,
value: `<https://github.com/voxmedia/github-action-slack-notify-build/actions/runs/${runId} | CI>`,
short: true,
});
});
Expand All @@ -45,7 +46,7 @@ describe('Utils', () => {

expect(attachments[0].fields.find(a => a.title === 'Job')).toEqual({
title: 'Job',
value: `<https://github.com/voxmedia/github-action-slack-notify-build/actions/runs/${process.env.GITHUB_JOB} | build and push>`,
value: `<https://github.com/voxmedia/github-action-slack-notify-build/actions/runs/${runId} | build and push>`,
short: true,
});
});
Expand Down Expand Up @@ -77,7 +78,7 @@ describe('Utils', () => {

expect(attachments[0].fields.find(a => a.title === 'Workflow')).toEqual({
title: 'Workflow',
value: `<https://github.com/voxmedia/github-action-slack-notify-build/actions/runs/${process.env.GITHUB_JOB} | CI>`,
value: `<https://github.com/voxmedia/github-action-slack-notify-build/actions/runs/${runId} | CI>`,
short: true,
});
});
Expand Down
4 changes: 0 additions & 4 deletions fixtures.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ export const GITHUB_PUSH_EVENT = {
workflow: 'CI',
eventName: 'push',
sha: 'abc123',
job: 'build and push',
runId: 12345,
},
};

Expand All @@ -35,7 +33,5 @@ export const GITHUB_PR_EVENT = {
workflow: 'CI',
eventName: 'pull_request',
sha: 'abc123',
job: 'build and push',
runId: process.env.GITHUB_JOB,
},
};

0 comments on commit 7a7ca58

Please sign in to comment.