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

[No QA][TS migration] migrate workflow tests #38491

Merged
Merged
Show file tree
Hide file tree
Changes from 8 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
9 changes: 0 additions & 9 deletions workflow_tests/jest.config.js

This file was deleted.

13 changes: 13 additions & 0 deletions workflow_tests/jest.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/* eslint-disable @typescript-eslint/naming-convention */
import type {Config} from 'jest';

const config: Config = {
verbose: true,
transform: {
'^.+\\.(js|jsx|ts|tsx)$': 'ts-jest',
},
clearMocks: true,
resetMocks: true,
};

export default config;
20 changes: 10 additions & 10 deletions workflow_tests/mocks/testBuildMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ const TESTBUILD__VALIDATEACTOR__SET_HAS_READY_TO_BUILD_LABEL_FLAG__FALSE__STEP_M
const TESTBUILD__VALIDATEACTOR__TEAM_MEMBER_HAS_FLAG__STEP_MOCKS = [
TESTBUILD__VALIDATEACTOR__IS_TEAM_MEMBER__TRUE__STEP_MOCK,
TESTBUILD__VALIDATEACTOR__SET_HAS_READY_TO_BUILD_LABEL_FLAG__TRUE__STEP_MOCK,
] as const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why remove as const? Those arrays aren't supposed to be modified, so that's fine in this file.

UPDATE: it's been causing erorrs, because it lacked satisfies StepIdentifier[]

];
const TESTBUILD__VALIDATEACTOR__TEAM_MEMBER_NO_FLAG__STEP_MOCKS = [
TESTBUILD__VALIDATEACTOR__IS_TEAM_MEMBER__TRUE__STEP_MOCK,
TESTBUILD__VALIDATEACTOR__SET_HAS_READY_TO_BUILD_LABEL_FLAG__FALSE__STEP_MOCK,
] as const;
];
const TESTBUILD__VALIDATEACTOR__NO_TEAM_MEMBER_HAS_FLAG__STEP_MOCKS = [
TESTBUILD__VALIDATEACTOR__IS_TEAM_MEMBER__FALSE__STEP_MOCK,
TESTBUILD__VALIDATEACTOR__SET_HAS_READY_TO_BUILD_LABEL_FLAG__TRUE__STEP_MOCK,
] as const;
];
const TESTBUILD__VALIDATEACTOR__NO_TEAM_MEMBER_NO_FLAG__STEP_MOCKS = [
TESTBUILD__VALIDATEACTOR__IS_TEAM_MEMBER__FALSE__STEP_MOCK,
TESTBUILD__VALIDATEACTOR__SET_HAS_READY_TO_BUILD_LABEL_FLAG__FALSE__STEP_MOCK,
] as const;
];

// getbranchref
const TESTBUILD__GETBRANCHREF__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checkout', 'GETBRANCHREF', [], []);
Expand All @@ -51,7 +51,7 @@ const TESTBUILD__GETBRANCHREF__CHECK_IF_PULL_REQUEST_NUMBER_IS_CORRECT__STEP_MOC
['GITHUB_TOKEN'],
{REF: 'test-ref'},
);
const TESTBUILD__GETBRANCHREF__STEP_MOCKS = [TESTBUILD__GETBRANCHREF__CHECKOUT__STEP_MOCK, TESTBUILD__GETBRANCHREF__CHECK_IF_PULL_REQUEST_NUMBER_IS_CORRECT__STEP_MOCK] as const;
const TESTBUILD__GETBRANCHREF__STEP_MOCKS = [TESTBUILD__GETBRANCHREF__CHECKOUT__STEP_MOCK, TESTBUILD__GETBRANCHREF__CHECK_IF_PULL_REQUEST_NUMBER_IS_CORRECT__STEP_MOCK];

// android
const TESTBUILD__ANDROID__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checkout', 'ANDROID', ['ref'], []);
Expand Down Expand Up @@ -95,7 +95,7 @@ const TESTBUILD__ANDROID__STEP_MOCKS = [
TESTBUILD__ANDROID__CONFIGURE_MAPBOX_SDK__STEP_MOCK,
TESTBUILD__ANDROID__RUN_FASTLANE_BETA_TEST__STEP_MOCK,
TESTBUILD__ANDROID__UPLOAD_ARTIFACT__STEP_MOCK,
] as const;
];

// ios
const TESTBUILD__IOS__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checkout', 'IOS', ['ref'], []);
Expand Down Expand Up @@ -151,7 +151,7 @@ const TESTBUILD__IOS__STEP_MOCKS = [
TESTBUILD__IOS__CONFIGURE_AWS_CREDENTIALS__STEP_MOCK,
TESTBUILD__IOS__RUN_FASTLANE__STEP_MOCK,
TESTBUILD__IOS__UPLOAD_ARTIFACT__STEP_MOCK,
] as const;
];

// desktop
const TESTBUILD__DESKTOP__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checkout', 'DESKTOP', ['ref'], []);
Expand Down Expand Up @@ -191,7 +191,7 @@ const TESTBUILD__DESKTOP__STEP_MOCKS = [
TESTBUILD__DESKTOP__DECRYPT_DEVELOPER_ID_CERTIFICATE__STEP_MOCK,
TESTBUILD__DESKTOP__CONFIGURE_AWS_CREDENTIALS__STEP_MOCK,
TESTBUILD__DESKTOP__BUILD_DESKTOP_APP_FOR_TESTING__STEP_MOCK,
] as const;
];

// web
const TESTBUILD__WEB__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checkout', 'WEB', ['ref'], []);
Expand Down Expand Up @@ -221,7 +221,7 @@ const TESTBUILD__WEB__STEP_MOCKS = [
TESTBUILD__WEB__BUILD_WEB_FOR_TESTING__STEP_MOCK,
TESTBUILD__WEB__BUILD_DOCS__STEP_MOCK,
TESTBUILD__WEB__DEPLOY_TO_S3_FOR_INTERNAL_TESTING__STEP_MOCK,
] as const;
];

// postgithubcomment
const TESTBUILD__POSTGITHUBCOMMENT__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checkout', 'POSTGITHUBCOMMENT', ['ref'], []);
Expand All @@ -245,7 +245,7 @@ const TESTBUILD__POSTGITHUBCOMMENT__STEP_MOCKS = [
TESTBUILD__POSTGITHUBCOMMENT__READ_JSONS_WITH_ANDROID_PATHS__STEP_MOCK,
TESTBUILD__POSTGITHUBCOMMENT__READ_JSONS_WITH_IOS_PATHS__STEP_MOCK,
TESTBUILD__POSTGITHUBCOMMENT__PUBLISH_LINKS_TO_APPS_FOR_DOWNLOAD__STEP_MOCK,
] as const;
];

export {
TESTBUILD__VALIDATEACTOR__TEAM_MEMBER_HAS_FLAG__STEP_MOCKS,
Expand Down
2 changes: 1 addition & 1 deletion workflow_tests/mocks/validateGithubActionsMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const VALIDATEGITHUBACTIONS__VERIFY__STEP_MOCKS = [
VALIDATEGITHUBACTIONS__VERIFY__SETUP_NODE__STEP_MOCK,
VALIDATEGITHUBACTIONS__VERIFY__VERIFY_JAVASCRIPT_ACTION_BUILDS__STEP_MOCK,
VALIDATEGITHUBACTIONS__VERIFY__VALIDATE_ACTIONS_AND_WORKFLOWS__STEP_MOCK,
] as const;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

];

export {
// eslint-disable-next-line import/prefer-default-export
Expand Down
6 changes: 1 addition & 5 deletions workflow_tests/mocks/verifyPodfileMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,7 @@ import {createMockStep} from '../utils/utils';
const VERIFYPODFILE__VERIFY__CHECKOUT__STEP_MOCK = createMockStep('Checkout', 'Checkout', 'VERIFY');
const VERIFYPODFILE__VERIFY__SETUP_NODE__STEP_MOCK = createMockStep('Setup Node', 'Setup Node', 'VERIFY', [], []);
const VERIFYPODFILE__VERIFY__VERIFY_PODFILE__STEP_MOCK = createMockStep('Verify podfile', 'Verify podfile', 'VERIFY', [], []);
const VERIFYPODFILE__VERIFY__STEP_MOCKS = [
VERIFYPODFILE__VERIFY__CHECKOUT__STEP_MOCK,
VERIFYPODFILE__VERIFY__SETUP_NODE__STEP_MOCK,
VERIFYPODFILE__VERIFY__VERIFY_PODFILE__STEP_MOCK,
] as const;
const VERIFYPODFILE__VERIFY__STEP_MOCKS = [VERIFYPODFILE__VERIFY__CHECKOUT__STEP_MOCK, VERIFYPODFILE__VERIFY__SETUP_NODE__STEP_MOCK, VERIFYPODFILE__VERIFY__VERIFY_PODFILE__STEP_MOCK];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


export {
// eslint-disable-next-line import/prefer-default-export
Expand Down
2 changes: 1 addition & 1 deletion workflow_tests/mocks/verifySignedCommitsMocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const VERIFYSIGNEDCOMMITS__VERIFYSIGNEDCOMMITS__VERIFY_SIGNED_COMMITS__STEP_MOCK
['GITHUB_TOKEN'],
[],
);
const VERIFYSIGNEDCOMMITS__VERIFYSIGNEDCOMMITS__STEP_MOCKS = [VERIFYSIGNEDCOMMITS__VERIFYSIGNEDCOMMITS__VERIFY_SIGNED_COMMITS__STEP_MOCK] as const;
const VERIFYSIGNEDCOMMITS__VERIFYSIGNEDCOMMITS__STEP_MOCKS = [VERIFYSIGNEDCOMMITS__VERIFYSIGNEDCOMMITS__VERIFY_SIGNED_COMMITS__STEP_MOCK];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same


export {
// eslint-disable-next-line import/prefer-default-export
Expand Down
2 changes: 1 addition & 1 deletion workflow_tests/scripts/runWorkflowTests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,4 @@ info 'ACT_BINARY environment variable set to an Act executable'
success 'Environment setup properly - running tests'

# Run tests
npm test -- --config=workflow_tests/jest.config.js --runInBand "$@"
npm test -- --config=workflow_tests/jest.config.ts --runInBand "$@"
Loading
Loading