Skip to content

Commit

Permalink
fix: addressed comments
Browse files Browse the repository at this point in the history
  • Loading branch information
akshbhu committed Oct 21, 2021
1 parent f71935d commit 01939b4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@ jest.mock('amplify-prompts');
jest.mock('fs-extra');

jest.mock('amplify-cli-core', () => ({
...(jest.requireActual('amplify-cli-core') as {}),
pathManager: {
findProjectRoot: jest.fn().mockReturnValue('somePath'),
getBackendDirPath: jest.fn().mockReturnValue('mockProjectPath'),
getResourceDirectoryPath: jest.fn().mockReturnValue('mockProjectPath'),
},
JSONUtilities: {
readJson: jest.fn().mockReturnValue({
Expand Down Expand Up @@ -82,7 +84,7 @@ jest.mock('amplify-cli-core', () => ({
test('migrate resource', async () => {
const resourceName = 'mockResource';
migrateResourceToSupportOverride(resourceName);
const expectedPath = path.join('mockProjectPath', 'auth', resourceName, 'cli-inputs.json');
const expectedPath = path.join('mockProjectPath', 'cli-inputs.json');
const expectedPayload = {
version: '1',
cognitoConfig: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { $TSObject, JSONUtilities, NotInitializedError, pathManager } from 'amplify-cli-core';
import { $TSObject, AmplifyCategories, JSONUtilities, NotInitializedError, pathManager } from 'amplify-cli-core';
import { printer } from 'amplify-prompts';
import * as path from 'path';
import uuid from 'uuid';
Expand Down Expand Up @@ -30,8 +30,8 @@ export const migrateResourceToSupportOverride = async (resourceName: string) =>
// New project, hence not able to find the amplify dir
throw new NotInitializedError();
}
const authresourceDirPath = path.join(pathManager.getBackendDirPath(), 'auth', resourceName);
const userPoolGroupResourceDirPath = path.join(pathManager.getBackendDirPath(), 'auth', 'userPoolGroups');
const authresourceDirPath = pathManager.getResourceDirectoryPath(undefined, AmplifyCategories.AUTH, resourceName);
const userPoolGroupResourceDirPath = pathManager.getResourceDirectoryPath(undefined, AmplifyCategories.AUTH, 'userPoolGroups');
const backupAuthResourceFolder = backup(authresourceDirPath, projectPath, resourceName);
const backupUserPoolGroupResourceFolder = backup(userPoolGroupResourceDirPath, projectPath, 'userPoolGroups');

Expand Down

0 comments on commit 01939b4

Please sign in to comment.