Skip to content

Commit

Permalink
fix(test): fix integration test
Browse files Browse the repository at this point in the history
fix integration test
  • Loading branch information
simeng-li committed Jul 11, 2024
1 parent c7096f8 commit 889e369
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 18 deletions.
4 changes: 2 additions & 2 deletions packages/integration-tests/src/helpers/experience/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import {
InteractionEvent,
InteractionIdentifierType,
SignInIdentifier,
type InteractionIdentifier,
type VerificationCodeIdentifier,
} from '@logto/schemas';
Expand Down Expand Up @@ -86,7 +86,7 @@ export const identifyUserWithUsernamePassword = async (

const { verificationId } = await client.verifyPassword({
identifier: {
type: InteractionIdentifierType.Username,
type: SignInIdentifier.Username,
value: username,
},
password,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InteractionEvent, InteractionIdentifierType } from '@logto/schemas';
import { InteractionEvent, SignInIdentifier } from '@logto/schemas';

import { initExperienceClient } from '#src/helpers/client.js';
import { expectRejects } from '#src/helpers/index.js';
Expand All @@ -19,7 +19,7 @@ devFeatureTest.describe('PUT /experience API', () => {
const client = await initExperienceClient();
await client.initInteraction({ interactionEvent: InteractionEvent.SignIn });
const { verificationId } = await client.verifyPassword({
identifier: { type: InteractionIdentifierType.Username, value: username },
identifier: { type: SignInIdentifier.Username, value: username },
password,
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InteractionIdentifierType } from '@logto/schemas';
import { SignInIdentifier } from '@logto/schemas';

import { deleteUser } from '#src/api/admin-user.js';
import { signInWithPassword } from '#src/helpers/experience/index.js';
Expand All @@ -17,7 +17,7 @@ devFeatureTest.describe('sign-in with password verification happy path', () => {
await enableAllPasswordSignInMethods();
});

it.each(Object.values(InteractionIdentifierType))(
it.each(Object.values(SignInIdentifier))(
'should sign-in with password using %p',
async (identifier) => {
const { userProfile, user } = await generateNewUser({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InteractionIdentifierType } from '@logto/schemas';
import { SignInIdentifier } from '@logto/schemas';

import { deleteUser } from '#src/api/admin-user.js';
import { setEmailConnector, setSmsConnector } from '#src/helpers/connector.js';
Expand All @@ -7,10 +7,8 @@ import { enableAllVerificationCodeSignInMethods } from '#src/helpers/sign-in-exp
import { generateNewUser } from '#src/helpers/user.js';
import { devFeatureTest } from '#src/utils.js';

const verificationIdentifierType: readonly [
InteractionIdentifierType.Email,
InteractionIdentifierType.Phone,
] = Object.freeze([InteractionIdentifierType.Email, InteractionIdentifierType.Phone]);
const verificationIdentifierType: readonly [SignInIdentifier.Email, SignInIdentifier.Phone] =
Object.freeze([SignInIdentifier.Email, SignInIdentifier.Phone]);

const identifiersTypeToUserProfile = Object.freeze({
email: 'primaryEmail',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { InteractionIdentifierType } from '@logto/schemas';
import { SignInIdentifier } from '@logto/schemas';

import { deleteUser } from '#src/api/admin-user.js';
import { initExperienceClient } from '#src/helpers/client.js';
Expand All @@ -12,7 +12,7 @@ const identifiersTypeToUserProfile = Object.freeze({
});

devFeatureTest.describe('password verifications', () => {
it.each(Object.values(InteractionIdentifierType))(
it.each(Object.values(SignInIdentifier))(
'should verify with password successfully using %p',
async (identifier) => {
const { userProfile, user } = await generateNewUser({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ConnectorType } from '@logto/connector-kit';
import { InteractionEvent, InteractionIdentifierType } from '@logto/schemas';
import { InteractionEvent, SignInIdentifier } from '@logto/schemas';

import { mockEmailConnectorId, mockSocialConnectorId } from '#src/__mocks__/connectors-mock.js';
import { initExperienceClient } from '#src/helpers/client.js';
Expand Down Expand Up @@ -134,7 +134,7 @@ devFeatureTest.describe('social verification', () => {

const { verificationId } = await client.sendVerificationCode({
identifier: {
type: InteractionIdentifierType.Email,
type: SignInIdentifier.Email,
value: 'foo',
},
interactionEvent: InteractionEvent.SignIn,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { ConnectorType } from '@logto/connector-kit';
import {
InteractionEvent,
InteractionIdentifierType,
SignInIdentifier,
type VerificationCodeIdentifier,
} from '@logto/schemas';

Expand All @@ -25,11 +25,11 @@ devFeatureTest.describe('Verification code verification APIs', () => {

const identifiers: VerificationCodeIdentifier[] = [
{
type: InteractionIdentifierType.Email,
type: SignInIdentifier.Email,
value: '[email protected]',
},
{
type: InteractionIdentifierType.Phone,
type: SignInIdentifier.Phone,
value: '+1234567890',
},
];
Expand Down

0 comments on commit 889e369

Please sign in to comment.