Skip to content

Commit 7225a78

Browse files
committed
tidy test case, resolve lint issues
1 parent a24b3c5 commit 7225a78

1 file changed

Lines changed: 20 additions & 20 deletions

File tree

tests/unit/createOrUpdateStagingDeployTest.ts

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
import * as core from '@actions/core';
2+
import * as fns from 'date-fns';
3+
import {vol} from 'memfs';
4+
import path from 'path';
5+
import run from '@github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy';
6+
import CONST from '@github/libs/CONST';
7+
import type {InternalOctokit} from '@github/libs/GithubUtils';
8+
import GithubUtils from '@github/libs/GithubUtils';
9+
import GitUtils from '@github/libs/GitUtils';
10+
111
/**
212
* @jest-environment node
313
*/
@@ -16,17 +26,6 @@ jest.mock('@actions/core', () => ({
1626
setFailed: jest.fn(),
1727
}));
1828

19-
import * as fns from 'date-fns';
20-
import {vol} from 'memfs';
21-
import path from 'path';
22-
import run from '@github/actions/javascript/createOrUpdateStagingDeploy/createOrUpdateStagingDeploy';
23-
import CONST from '@github/libs/CONST';
24-
import type {InternalOctokit} from '@github/libs/GithubUtils';
25-
import GithubUtils from '@github/libs/GithubUtils';
26-
import GitUtils from '@github/libs/GitUtils';
27-
28-
import * as core from '@actions/core';
29-
3029
const mockGetInput = core.getInput as jest.MockedFunction<typeof core.getInput>;
3130

3231
type Arguments = {
@@ -40,7 +39,6 @@ const mockListIssues = jest.fn();
4039
const mockGetPullRequestsDeployedBetween = jest.fn();
4140

4241
beforeAll(() => {
43-
4442
// Mock octokit module
4543
const mockOctokit = {
4644
rest: {
@@ -132,7 +130,7 @@ const basePRList = [
132130
];
133131

134132
const baseIssueList = [`https://github.com/${process.env.GITHUB_REPOSITORY}/issues/11`, `https://github.com/${process.env.GITHUB_REPOSITORY}/issues/12`];
135-
// eslint-disable-next-line max-len
133+
// eslint-disable-next-line max-len, cspell:disable-next-line
136134
const baseExpectedOutput = (version = '1.0.2-1') =>
137135
`**Release Version:** \`${version}\`\r\n**Compare Changes:** https://github.com/${process.env.GITHUB_REPOSITORY}/compare/production...staging\r\n\r\n> 💡 **Deployer FYI:** This checklist was generated using a new process. PR listfrom original method and detail logging can be found in the most recent [deploy workflow](https://github.com/Expensify/App/actions/workflows/deploy.yml) labeled \`staging\`, in the \`createChecklist\` action. Please tag @Julesssss with any issues.\r\n\r\n\r\n**This release contains changes from the following pull requests:**\r\n`;
138136
const openCheckbox = '- [ ] ';
@@ -407,8 +405,8 @@ describe('createOrUpdateStagingDeployCash', () => {
407405
vol.fromJSON({
408406
[PATH_TO_PACKAGE_JSON]: JSON.stringify({version: '1.0.3-0'}),
409407
});
410-
411-
mockGetInput.mockImplementation((arg) => arg === 'GITHUB_TOKEN' ? 'fake_token' : '');
408+
409+
mockGetInput.mockImplementation((arg) => (arg === 'GITHUB_TOKEN' ? 'fake_token' : ''));
412410
mockGetPullRequestsDeployedBetween.mockImplementation((fromRef, toRef) => {
413411
if (fromRef === '1.0.2-1-staging' && toRef === '1.0.3-0-staging') {
414412
return [6, 8, 10, 11];
@@ -440,11 +438,13 @@ describe('createOrUpdateStagingDeployCash', () => {
440438
mockListIssues.mockImplementation((args: Arguments) => {
441439
if (args.labels === CONST.LABELS.STAGING_DEPLOY) {
442440
return Promise.resolve({
443-
data: [{
444-
number: 29,
445-
state: 'closed',
446-
labels: [LABELS.STAGING_DEPLOY_CASH],
447-
}]
441+
data: [
442+
{
443+
number: 29,
444+
state: 'closed',
445+
labels: [LABELS.STAGING_DEPLOY_CASH],
446+
},
447+
],
448448
});
449449
}
450450
return Promise.resolve({data: []});

0 commit comments

Comments
 (0)