Skip to content

Commit

Permalink
chore: test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rtpascual committed Oct 25, 2023
1 parent 294cf17 commit e560e9e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ describe('transformer predictions migration test', () => {
expect(translateResult.errors).toBeUndefined();
expect(translateResult.data).toBeDefined();
expect((translateResult.data as any).translateThis).toMatch(
/((\bDies\b)|(\bdas\b)|(\bder\b)) ist ein ((\bStimmtest\b)|(\Sprachtest\b))/i,
/((\bDies\b)|(\bdas\b)|(\bder\b)) ist ein ((\bStimmtest\b)|(\Sprachtest\b)|(\bStimmentest\b))/i,
);

const speakQuery = /* GraphQL */ `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ let mockCognitoIdentityRoles = {
unauthenticated: 'arn:aws:iam::123456789012:role/service-role/my-unauth-role',
};

const iamRoleNameRegex = /[\w+=,.@-]+/;

jest.mock('aws-sdk', () => {
return {
CognitoIdentity: jest.fn(() => {
Expand Down Expand Up @@ -37,8 +39,8 @@ describe('IdentityPoolService', () => {

// ensure role names match regex for IAM
// see: https://docs.aws.amazon.com/IAM/latest/APIReference/API_Role.html
expect(identityPoolRoles.authRoleName).toMatch(/[\w+=,.@-]+/);
expect(identityPoolRoles.unauthRoleName).toMatch(/[\w+=,.@-]+/);
expect(identityPoolRoles.authRoleName).toMatch(iamRoleNameRegex);
expect(identityPoolRoles.unauthRoleName).toMatch(iamRoleNameRegex);

expect(identityPoolRoles).toEqual({
authRoleArn: 'arn:aws:iam::123456789012:role/service-role/my-auth-role',
Expand All @@ -59,8 +61,8 @@ describe('IdentityPoolService', () => {

// ensure role names match regex for IAM
// see: https://docs.aws.amazon.com/IAM/latest/APIReference/API_Role.html
expect(identityPoolRoles.authRoleName).toMatch(/[\w+=,.@-]+/);
expect(identityPoolRoles.unauthRoleName).toMatch(/[\w+=,.@-]+/);
expect(identityPoolRoles.authRoleName).toMatch(iamRoleNameRegex);
expect(identityPoolRoles.unauthRoleName).toMatch(iamRoleNameRegex);

expect(identityPoolRoles).toEqual({
authRoleArn: 'arn:aws:iam::123456789012:role/my-auth-role',
Expand Down

0 comments on commit e560e9e

Please sign in to comment.