From a97f7c9908c52d41cac154ea953484b5e66a69cb Mon Sep 17 00:00:00 2001 From: Szymon Dziedzic Date: Mon, 14 Oct 2024 14:26:24 +0200 Subject: [PATCH] fix tests --- .../src/commands/project/__tests__/init.test.ts | 3 +++ .../src/commands/update/__tests__/index.test.ts | 11 +---------- .../update/__tests__/roll-back-to-embedded.test.ts | 11 +---------- .../src/credentials/__tests__/fixtures-context.ts | 3 ++- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/packages/eas-cli/src/commands/project/__tests__/init.test.ts b/packages/eas-cli/src/commands/project/__tests__/init.test.ts index 7ea1c0f237..937096ad0f 100644 --- a/packages/eas-cli/src/commands/project/__tests__/init.test.ts +++ b/packages/eas-cli/src/commands/project/__tests__/init.test.ts @@ -14,6 +14,7 @@ import { AppMutation } from '../../../graphql/mutations/AppMutation'; import { AppQuery } from '../../../graphql/queries/AppQuery'; import { createOrModifyExpoConfigAsync } from '../../../project/expoConfig'; import { findProjectIdByAccountNameAndSlugNullableAsync } from '../../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync'; +import { isExpoInstalled } from '../../../project/projectUtils'; import { confirmAsync, promptAsync } from '../../../prompts'; import ProjectInit from '../init'; @@ -34,6 +35,7 @@ jest.mock('../../../ora', () => ({ })); jest.mock('../../../project/fetchOrCreateProjectIDForWriteToConfigWithConfirmationAsync'); jest.mock('../../../commandUtils/context/contextUtils/getProjectIdAsync'); +jest.mock('../../../project/projectUtils'); let originalProcessArgv: string[]; @@ -91,6 +93,7 @@ function mockTestProject(options: { featureGating: new FeatureGating({}, new FeatureGateEnvOverrides()), graphqlClient, }); + jest.mocked(isExpoInstalled).mockReturnValue(true); } const commandOptions = { root: '/test-project' } as any; diff --git a/packages/eas-cli/src/commands/update/__tests__/index.test.ts b/packages/eas-cli/src/commands/update/__tests__/index.test.ts index b942b30860..e30b20172e 100644 --- a/packages/eas-cli/src/commands/update/__tests__/index.test.ts +++ b/packages/eas-cli/src/commands/update/__tests__/index.test.ts @@ -140,16 +140,7 @@ describe(UpdatePublish.name, () => { // Add configuration to the project that should not be included in the update const { appJson } = mockTestProject({ - expoConfig: { - hooks: { - postPublish: [ - { - file: 'custom-hook.js', - config: { some: 'config' }, - }, - ], - }, - }, + expoConfig: {}, }); const { platforms, runtimeVersion } = mockTestExport({ platforms: ['ios'] }); diff --git a/packages/eas-cli/src/commands/update/__tests__/roll-back-to-embedded.test.ts b/packages/eas-cli/src/commands/update/__tests__/roll-back-to-embedded.test.ts index 0ffd93be63..61706cc97e 100644 --- a/packages/eas-cli/src/commands/update/__tests__/roll-back-to-embedded.test.ts +++ b/packages/eas-cli/src/commands/update/__tests__/roll-back-to-embedded.test.ts @@ -146,16 +146,7 @@ describe(UpdateRollBackToEmbedded.name, () => { // Add configuration to the project that should not be included in the update mockTestProject({ - expoConfig: { - hooks: { - postPublish: [ - { - file: 'custom-hook.js', - config: { some: 'config' }, - }, - ], - }, - }, + expoConfig: {}, }); const platforms = ['ios']; diff --git a/packages/eas-cli/src/credentials/__tests__/fixtures-context.ts b/packages/eas-cli/src/credentials/__tests__/fixtures-context.ts index 67f01b8d0b..14dbcecd3f 100644 --- a/packages/eas-cli/src/credentials/__tests__/fixtures-context.ts +++ b/packages/eas-cli/src/credentials/__tests__/fixtures-context.ts @@ -21,8 +21,9 @@ export function createCtxMock(mockOverride: Record = {}): Credentia }, hasAppleCtx: jest.fn(() => true), hasProjectContext: true, - exp: testAppJson, + getExpoConfigAsync: async () => testAppJson, projectDir: '.', + getProjectIdAsync: async () => 'test-project-id', }; return merge(defaultMock, mockOverride) as any; }