Skip to content

Commit

Permalink
refactor(test): refine the export type
Browse files Browse the repository at this point in the history
refine the export type
  • Loading branch information
simeng-li committed Jun 17, 2024
1 parent 392bb80 commit 1786c3d
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 11 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { getUserOrganizations } from '#src/api/index.js';
import { OrganizationApiTest } from '#src/helpers/organization.js';
import { UserApiTest } from '#src/helpers/user.js';
import { devFeatureDescribe, randomString } from '#src/utils.js';
import { devFeatureTest, randomString } from '#src/utils.js';

devFeatureDescribe('organization just-in-time provisioning', () => {
devFeatureTest.describe('organization just-in-time provisioning', () => {
const organizationApi = new OrganizationApiTest();
const userApi = new UserApiTest();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { registerWithEmail } from '#src/helpers/interactions.js';
import { OrganizationApiTest } from '#src/helpers/organization.js';
import { enableAllVerificationCodeSignInMethods } from '#src/helpers/sign-in-experience.js';
import { UserApiTest } from '#src/helpers/user.js';
import { devFeatureDescribe, generateName, generateRoleName, randomString } from '#src/utils.js';
import { devFeatureTest, generateName, generateRoleName, randomString } from '#src/utils.js';

import WebhookMockServer from './WebhookMockServer.js';
import { assertHookLogResult } from './utils.js';
Expand Down Expand Up @@ -119,7 +119,7 @@ describe('manual data hook tests', () => {
},
});

devFeatureDescribe(
devFeatureTest.describe(
'organization membership update by just-in-time organization provisioning',
() => {
it('should trigger `Organization.Membership.Updated` event when user is provisioned by Management API', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import {
enableAllVerificationCodeSignInMethods,
resetPasswordPolicy,
} from '#src/helpers/sign-in-experience.js';
import { devFeatureDescribe, randomString } from '#src/utils.js';
import { devFeatureTest, randomString } from '#src/utils.js';

devFeatureDescribe('organization just-in-time provisioning', () => {
devFeatureTest.describe('organization just-in-time provisioning', () => {
const organizationApi = new OrganizationApiTest();

afterEach(async () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { generateStandardId } from '@logto/shared';

import { OrganizationApiTest } from '#src/helpers/organization.js';
import { devFeatureDescribe } from '#src/utils.js';
import { devFeatureTest } from '#src/utils.js';

const randomId = () => generateStandardId(6);

devFeatureDescribe('organization email domains', () => {
devFeatureTest.describe('organization email domains', () => {
const organizationApi = new OrganizationApiTest();

afterEach(async () => {
Expand Down
7 changes: 4 additions & 3 deletions packages/integration-tests/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export const generateTestName = () => `test_${generateStandardId(4)}`;

export const randomString = () => crypto.randomBytes(8).toString('hex');

export const devFeatureIt = isDevFeaturesEnabled ? it : it.skip;

export const devFeatureDescribe = isDevFeaturesEnabled ? describe : describe.skip;
export const devFeatureTest = Object.freeze({
it: isDevFeaturesEnabled ? it : it.skip,
describe: isDevFeaturesEnabled ? describe : describe.skip,
});

0 comments on commit 1786c3d

Please sign in to comment.