From 156538a2dca5fabbbe06f3e462d78f8acc19cc5d Mon Sep 17 00:00:00 2001 From: Danielle Adams Date: Thu, 21 Apr 2022 14:04:34 -0400 Subject: [PATCH] test: rm e2e test changes and move to https://github.com/aws-amplify/amplify-cli/pull/10198 --- .../__snapshots__/api_2.test.ts.snap | 8 ++--- .../src/__tests__/api_2.test.ts | 34 ------------------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/packages/amplify-e2e-tests/src/__tests__/__snapshots__/api_2.test.ts.snap b/packages/amplify-e2e-tests/src/__tests__/__snapshots__/api_2.test.ts.snap index 016abbb5af8..cd1ee77df60 100644 --- a/packages/amplify-e2e-tests/src/__tests__/__snapshots__/api_2.test.ts.snap +++ b/packages/amplify-e2e-tests/src/__tests__/__snapshots__/api_2.test.ts.snap @@ -12,9 +12,7 @@ $util.unauthorized() #if( $util.authType() == \\"User Pool Authorization\\" ) #if( !$isAuthorized ) #set( $ownerEntity0 = $util.defaultIfNull($ctx.args.input.owner, null) ) - #set( $ownerClaim0 = $ctx.identity.claims.get(\\"sub\\") ) - #set( $currentClaim0 = $util.defaultIfNull($ctx.identity.claims.get(\\"username\\"), $util.defaultIfNull($ctx.identity.claims.get(\\"cognito:username\\"), \\"___xamznone____\\")) ) - #set( $ownerClaim0 = \\"$ownerClaim0:$currentClaim0\\" ) + #set( $ownerClaim0 = $util.defaultIfNull($ctx.identity.claims.get(\\"username\\"), $util.defaultIfNull($ctx.identity.claims.get(\\"cognito:username\\"), \\"___xamznone____\\")) ) #set( $ownerAllowedFields0 = [\\"id\\",\\"content\\"] ) #set( $isAuthorizedOnAllFields0 = true ) #if( $ownerClaim0 == $ownerEntity0 ) @@ -65,9 +63,7 @@ $util.unauthorized() #if( $util.authType() == \\"User Pool Authorization\\" ) #if( !$isAuthorized ) #set( $ownerEntity0 = $util.defaultIfNull($ctx.args.input.owner, null) ) - #set( $ownerClaim0 = $ctx.identity.claims.get(\\"sub\\") ) - #set( $currentClaim0 = $util.defaultIfNull($ctx.identity.claims.get(\\"username\\"), $util.defaultIfNull($ctx.identity.claims.get(\\"cognito:username\\"), \\"___xamznone____\\")) ) - #set( $ownerClaim0 = \\"$ownerClaim0:$currentClaim0\\" ) + #set( $ownerClaim0 = $util.defaultIfNull($ctx.identity.claims.get(\\"username\\"), $util.defaultIfNull($ctx.identity.claims.get(\\"cognito:username\\"), \\"___xamznone____\\")) ) #set( $ownerAllowedFields0 = [\\"id\\",\\"content\\"] ) #set( $isAuthorizedOnAllFields0 = true ) #if( $ownerClaim0 == $ownerEntity0 ) diff --git a/packages/amplify-e2e-tests/src/__tests__/api_2.test.ts b/packages/amplify-e2e-tests/src/__tests__/api_2.test.ts index bc0f9e97fe4..cdcaa4dbb1f 100644 --- a/packages/amplify-e2e-tests/src/__tests__/api_2.test.ts +++ b/packages/amplify-e2e-tests/src/__tests__/api_2.test.ts @@ -1,4 +1,3 @@ -/* eslint-disable */ import { JSONUtilities } from 'amplify-cli-core'; import { addApi, @@ -21,7 +20,6 @@ import { updateApiSchema, updateAPIWithResolutionStrategyWithModels, setCustomRolesConfig, - addFeatureFlag, } from 'amplify-e2e-core'; import AWSAppSyncClient, { AUTH_TYPE } from 'aws-appsync'; import { existsSync, readFileSync } from 'fs'; @@ -309,36 +307,6 @@ describe('amplify add api (GraphQL)', () => { expect(beforeAdminConfig).not.toEqual(afterAdminConfig); }); - it('init a project and add custom iam roles - local test with gql v2 w/ identity claim feature flag disabled', async () => { - const name = 'customadminroles'; - await initJSProjectWithProfile(projRoot, { name }); - addFeatureFlag(projRoot, 'graphqlTransformer', 'userSubUsernameForDefaultIdentityClaim', false); - await addApi(projRoot, { transformerVersion: 2, IAM: {}, 'Amazon Cognito User Pool': {} }); - updateApiSchema(projRoot, name, 'cognito_simple_model.graphql'); - await apiGqlCompile(projRoot); - const createResolver = path.join( - projRoot, - 'amplify', - 'backend', - 'api', - name, - 'build', - 'resolvers', - 'Mutation.createTodo.auth.1.req.vtl', - ); - const beforeAdminConfig = readFileSync(createResolver).toString(); - expect(beforeAdminConfig).toMatchSnapshot(); - - const customRolesConfig = { - adminRoleNames: ['myAdminRoleName'], - }; - setCustomRolesConfig(projRoot, name, customRolesConfig); - await apiGqlCompile(projRoot); - const afterAdminConfig = readFileSync(createResolver).toString(); - expect(afterAdminConfig).toMatchSnapshot(); - expect(beforeAdminConfig).not.toEqual(afterAdminConfig); - }); - // TODO: Disabling for now until further conversation. // it('inits a project with a simple model with deletion protection enabled and then migrates the api', async () => { // const projectName = 'retaintables'; @@ -369,5 +337,3 @@ describe('amplify add api (GraphQL)', () => { // } // }); }); - -/* eslint-enable */