Skip to content

Commit

Permalink
chore: replace local impls for showApiAuthAcm and authNotifications w…
Browse files Browse the repository at this point in the history
…ith api calls
  • Loading branch information
alharris-at committed May 26, 2023
1 parent b01aa4b commit fdd580f
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 871 deletions.
2 changes: 0 additions & 2 deletions packages/amplify-cli/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,6 @@
"@aws-amplify/amplify-util-import": "2.6.0",
"@aws-amplify/amplify-util-mock": "5.2.3",
"@aws-amplify/amplify-util-uibuilder": "1.8.3",
"@aws-amplify/graphql-auth-transformer": "^2.1.4",
"@aws-amplify/graphql-transformer-core": "^1.3.0",
"@aws-cdk/cloudformation-diff": "~2.68.0",
"amplify-codegen": "^3.4.4",
"amplify-dotnet-function-runtime-provider": "2.0.3",
Expand Down
16 changes: 7 additions & 9 deletions packages/amplify-cli/src/__tests__/commands/status.test.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { stateManager, pathManager } from '@aws-amplify/amplify-cli-core';
import { readProjectSchema } from 'graphql-transformer-core';
import { showApiAuthAcm } from '@aws-amplify/amplify-category-api';

jest.mock('@aws-amplify/amplify-category-hosting');
jest.mock('@aws-amplify/amplify-cli-core');
jest.mock('graphql-transformer-core', () => ({
readProjectSchema: jest.fn(async (__: string) => ''),
}));
jest.mock('../../extensions/amplify-helpers/show-auth-acm', () => ({
showACM: jest.fn(),
jest.mock('@aws-amplify/amplify-category-api', () => ({
showApiAuthAcm: jest.fn(async (_: any, __: string) => ''),
}));

const pathManagerMock = pathManager as jest.Mocked<typeof pathManager>;
pathManagerMock.getBackendDirPath.mockReturnValue('testBackendDirPath');

Expand All @@ -29,7 +27,7 @@ const mockGraphQLAPIMeta = {
const stateManagerMock = stateManager as jest.Mocked<typeof stateManager>;
stateManagerMock.getMeta = jest.fn().mockImplementation(() => mockGraphQLAPIMeta);

const readProjectSchemaMock = readProjectSchema as jest.MockedFunction<typeof readProjectSchema>;
const showApiAuthAcmMock = showApiAuthAcm as jest.MockedFunction<typeof showApiAuthAcm>;

describe('amplify status:', () => {
// eslint-disable-next-line global-require, @typescript-eslint/no-var-requires
Expand Down Expand Up @@ -130,7 +128,7 @@ describe('amplify status:', () => {
expect(mockContextWithHelpSubcommandAndCLArgs.amplify.showStatusTable.mock.calls.length).toBe(0);
});

it('status api -acm Table run method should call readProjectSchema', async () => {
it('status api -acm Table run method should call showApiAuthAcm', async () => {
const mockContextWithVerboseOptionAndCLArgs = {
amplify: {
getProviderPlugins: jest.fn().mockReturnValue({ awscloudformation: '../../__mocks__/faked-plugin' }),
Expand All @@ -155,6 +153,6 @@ describe('amplify status:', () => {
}));

await runStatusCmd(mockContextWithVerboseOptionAndCLArgs);
expect(readProjectSchemaMock.mock.calls.length).toBeGreaterThan(0);
expect(showApiAuthAcmMock.mock.calls.length).toBeGreaterThan(0);
});
});

This file was deleted.

This file was deleted.

85 changes: 0 additions & 85 deletions packages/amplify-cli/src/__tests__/push-notifications.test.ts

This file was deleted.

Loading

0 comments on commit fdd580f

Please sign in to comment.