From 91ecb7d951961bb8df032d1b3528e7d410e3efa0 Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Thu, 30 Oct 2025 12:19:42 +0100 Subject: [PATCH 1/7] refactor: properly convert organization ID to be UUID --- src/entity/Organization.ts | 6 ++--- .../ContentPreferenceOrganization.ts | 2 +- src/entity/opportunities/OpportunityJob.ts | 2 +- .../1761823015246-OrganizationIdUUID.ts | 24 +++++++++++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) create mode 100644 src/migration/1761823015246-OrganizationIdUUID.ts diff --git a/src/entity/Organization.ts b/src/entity/Organization.ts index 24e05db0b1..9675fea914 100644 --- a/src/entity/Organization.ts +++ b/src/entity/Organization.ts @@ -5,7 +5,7 @@ import { Entity, Index, OneToMany, - PrimaryColumn, + PrimaryGeneratedColumn, UpdateDateColumn, } from 'typeorm'; import type { ContentPreferenceOrganization } from './contentPreference/ContentPreferenceOrganization'; @@ -20,10 +20,8 @@ export type OrganizationLink = z.infer; @Entity() @Index('IDX_organization_subflags_subscriptionid', { synchronize: false }) export class Organization { - @PrimaryColumn({ - type: 'text', + @PrimaryGeneratedColumn('uuid', { primaryKeyConstraintName: 'PK_organization_organization_id', - default: () => 'uuid_generate_v4()', }) id: string; diff --git a/src/entity/contentPreference/ContentPreferenceOrganization.ts b/src/entity/contentPreference/ContentPreferenceOrganization.ts index 574b297f96..7bcc857f77 100644 --- a/src/entity/contentPreference/ContentPreferenceOrganization.ts +++ b/src/entity/contentPreference/ContentPreferenceOrganization.ts @@ -16,7 +16,7 @@ export type ContentPreferenceOrganizationFlags = Partial<{ @ChildEntity(ContentPreferenceType.Organization) export class ContentPreferenceOrganization extends ContentPreference { - @Column({ type: 'text', default: null }) + @Column({ type: 'uuid', default: null }) @Index('IDX_content_preference_organization_id') organizationId: string; diff --git a/src/entity/opportunities/OpportunityJob.ts b/src/entity/opportunities/OpportunityJob.ts index 28eac9158d..d2b78813a7 100644 --- a/src/entity/opportunities/OpportunityJob.ts +++ b/src/entity/opportunities/OpportunityJob.ts @@ -5,7 +5,7 @@ import type { Organization } from '../Organization'; @ChildEntity(OpportunityType.JOB) export class OpportunityJob extends Opportunity { - @Column({ type: 'text' }) + @Column({ type: 'uuid' }) @Index('IDX_opportunity_organization_id') organizationId: string; diff --git a/src/migration/1761823015246-OrganizationIdUUID.ts b/src/migration/1761823015246-OrganizationIdUUID.ts new file mode 100644 index 0000000000..6270ed2f4b --- /dev/null +++ b/src/migration/1761823015246-OrganizationIdUUID.ts @@ -0,0 +1,24 @@ +import { MigrationInterface, QueryRunner } from "typeorm"; + +export class OrganizationIdUUID1761823015246 implements MigrationInterface { + + public async up(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "content_preference" DROP CONSTRAINT "FK_content_preference_organization_id"`); + await queryRunner.query(`ALTER TABLE "opportunity" DROP CONSTRAINT "FK_opportunity_organization_id"`); + await queryRunner.query(`ALTER TABLE "organization" ALTER COLUMN "id" TYPE uuid USING "id"::uuid`); + await queryRunner.query(`ALTER TABLE "opportunity" ALTER COLUMN "organizationId" TYPE uuid USING "organizationId"::uuid`); + await queryRunner.query(`ALTER TABLE "content_preference" ALTER COLUMN "organizationId" TYPE uuid USING "organizationId"::uuid`); + await queryRunner.query(`ALTER TABLE "opportunity" ADD CONSTRAINT "FK_opportunity_organization_id" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "content_preference" ADD CONSTRAINT "FK_content_preference_organization_id" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + } + + public async down(queryRunner: QueryRunner): Promise { + await queryRunner.query(`ALTER TABLE "content_preference" DROP CONSTRAINT "FK_content_preference_organization_id"`); + await queryRunner.query(`ALTER TABLE "opportunity" DROP CONSTRAINT "FK_opportunity_organization_id"`); + await queryRunner.query(`ALTER TABLE "organization" ALTER COLUMN "id" TYPE text USING "id"::text`); + await queryRunner.query(`ALTER TABLE "opportunity" ALTER COLUMN "organizationId" TYPE text USING "organizationId"::text`); + await queryRunner.query(`ALTER TABLE "content_preference" ALTER COLUMN "organizationId" TYPE text USING "organizationId"::text`); + await queryRunner.query(`ALTER TABLE "opportunity" ADD CONSTRAINT "FK_opportunity_organization_id" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(`ALTER TABLE "content_preference" ADD CONSTRAINT "FK_content_preference_organization_id" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + } +} From e12415f60a176ab621f1811300856545b665ff5e Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Thu, 30 Oct 2025 12:21:59 +0100 Subject: [PATCH 2/7] fix: format migration --- .../1761823015246-OrganizationIdUUID.ts | 99 ++++++++++++++++--- 1 file changed, 84 insertions(+), 15 deletions(-) diff --git a/src/migration/1761823015246-OrganizationIdUUID.ts b/src/migration/1761823015246-OrganizationIdUUID.ts index 6270ed2f4b..c2c8a1c953 100644 --- a/src/migration/1761823015246-OrganizationIdUUID.ts +++ b/src/migration/1761823015246-OrganizationIdUUID.ts @@ -1,24 +1,93 @@ import { MigrationInterface, QueryRunner } from "typeorm"; export class OrganizationIdUUID1761823015246 implements MigrationInterface { - public async up(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "content_preference" DROP CONSTRAINT "FK_content_preference_organization_id"`); - await queryRunner.query(`ALTER TABLE "opportunity" DROP CONSTRAINT "FK_opportunity_organization_id"`); - await queryRunner.query(`ALTER TABLE "organization" ALTER COLUMN "id" TYPE uuid USING "id"::uuid`); - await queryRunner.query(`ALTER TABLE "opportunity" ALTER COLUMN "organizationId" TYPE uuid USING "organizationId"::uuid`); - await queryRunner.query(`ALTER TABLE "content_preference" ALTER COLUMN "organizationId" TYPE uuid USING "organizationId"::uuid`); - await queryRunner.query(`ALTER TABLE "opportunity" ADD CONSTRAINT "FK_opportunity_organization_id" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "content_preference" ADD CONSTRAINT "FK_content_preference_organization_id" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(/* sql */ ` + ALTER TABLE "content_preference" + DROP CONSTRAINT "FK_content_preference_organization_id" + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "opportunity" + DROP CONSTRAINT "FK_opportunity_organization_id" + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "organization" + ALTER COLUMN "id" TYPE uuid USING "id"::uuid + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "opportunity" + ALTER COLUMN "organizationId" TYPE uuid USING "organizationId"::uuid + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "content_preference" + ALTER COLUMN "organizationId" TYPE uuid USING "organizationId"::uuid + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "opportunity" + ADD CONSTRAINT "FK_opportunity_organization_id" + FOREIGN KEY ("organizationId") + REFERENCES "organization"("id") + ON DELETE CASCADE + ON UPDATE NO ACTION + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "content_preference" + ADD CONSTRAINT "FK_content_preference_organization_id" + FOREIGN KEY ("organizationId") + REFERENCES "organization"("id") + ON DELETE CASCADE + ON UPDATE NO ACTION + `); } public async down(queryRunner: QueryRunner): Promise { - await queryRunner.query(`ALTER TABLE "content_preference" DROP CONSTRAINT "FK_content_preference_organization_id"`); - await queryRunner.query(`ALTER TABLE "opportunity" DROP CONSTRAINT "FK_opportunity_organization_id"`); - await queryRunner.query(`ALTER TABLE "organization" ALTER COLUMN "id" TYPE text USING "id"::text`); - await queryRunner.query(`ALTER TABLE "opportunity" ALTER COLUMN "organizationId" TYPE text USING "organizationId"::text`); - await queryRunner.query(`ALTER TABLE "content_preference" ALTER COLUMN "organizationId" TYPE text USING "organizationId"::text`); - await queryRunner.query(`ALTER TABLE "opportunity" ADD CONSTRAINT "FK_opportunity_organization_id" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); - await queryRunner.query(`ALTER TABLE "content_preference" ADD CONSTRAINT "FK_content_preference_organization_id" FOREIGN KEY ("organizationId") REFERENCES "organization"("id") ON DELETE CASCADE ON UPDATE NO ACTION`); + await queryRunner.query(/* sql */ ` + ALTER TABLE "content_preference" + DROP CONSTRAINT "FK_content_preference_organization_id" + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "opportunity" + DROP CONSTRAINT "FK_opportunity_organization_id" + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "organization" + ALTER COLUMN "id" TYPE text USING "id"::text + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "opportunity" + ALTER COLUMN "organizationId" TYPE text USING "organizationId"::text + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "content_preference" + ALTER COLUMN "organizationId" TYPE text USING "organizationId"::text + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "opportunity" + ADD CONSTRAINT "FK_opportunity_organization_id" + FOREIGN KEY ("organizationId") + REFERENCES "organization"("id") + ON DELETE CASCADE + ON UPDATE NO ACTION + `); + + await queryRunner.query(/* sql */ ` + ALTER TABLE "content_preference" + ADD CONSTRAINT "FK_content_preference_organization_id" + FOREIGN KEY ("organizationId") + REFERENCES "organization"("id") + ON DELETE CASCADE + ON UPDATE NO ACTION + `); } } From 1f65dbb627b3b287d3228495929623b82a3fe918 Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:03:52 +0100 Subject: [PATCH 3/7] test: fix tests --- __tests__/boot.ts | 6 +- __tests__/organizations.ts | 431 ++++++++++++------ __tests__/private.ts | 10 +- __tests__/workers/cdc/primary.ts | 12 +- .../organization/organizationUserLeft.ts | 28 +- .../organization/organizationUserRemoved.ts | 20 +- 6 files changed, 322 insertions(+), 185 deletions(-) diff --git a/__tests__/boot.ts b/__tests__/boot.ts index ea95db1a1f..8c4a82a132 100644 --- a/__tests__/boot.ts +++ b/__tests__/boot.ts @@ -730,7 +730,7 @@ describe('logged in boot', () => { it('should set last activity in redis if user is part of organization', async () => { await saveFixtures(con, Organization, [ { - id: 'org-1', + id: 'bcc87627-7b19-40b6-a8f4-72dc94e764d5', seats: 1, name: 'Organization 1', subscriptionFlags: { @@ -750,8 +750,8 @@ describe('logged in boot', () => { await saveFixtures(con, ContentPreferenceOrganization, [ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: 'bcc87627-7b19-40b6-a8f4-72dc94e764d5', + organizationId: 'bcc87627-7b19-40b6-a8f4-72dc94e764d5', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { diff --git a/__tests__/organizations.ts b/__tests__/organizations.ts index d9825e85df..760971b167 100644 --- a/__tests__/organizations.ts +++ b/__tests__/organizations.ts @@ -51,7 +51,7 @@ beforeEach(async () => { await saveFixtures(con, Organization, [ { - id: 'org-1', + id: '9a212368-3388-4040-9c59-540f44c7a862', seats: 1, name: 'Organization 1', subscriptionFlags: { @@ -118,8 +118,8 @@ describe('query organizations', () => { await con.getRepository(ContentPreferenceOrganization).save({ userId: loggedUser, - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: loggedUser, status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -135,7 +135,7 @@ describe('query organizations', () => { role: 'owner', referralToken: 'ref-token-1', organization: { - id: 'org-1', + id: '9a212368-3388-4040-9c59-540f44c7a862', name: 'Organization 1', image: null, seats: 1, @@ -174,7 +174,10 @@ describe('query organization', () => { it('should not authorize when not logged-in', () => testQueryErrorCode( client, - { query: QUERY, variables: { id: 'org-1' } }, + { + query: QUERY, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, + }, 'UNAUTHENTICATED', )); @@ -193,7 +196,10 @@ describe('query organization', () => { testQueryErrorCode( client, - { query: QUERY, variables: { id: 'org-1' } }, + { + query: QUERY, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, + }, 'NOT_FOUND', ); }); @@ -208,8 +214,8 @@ describe('query organization', () => { await con.getRepository(ContentPreferenceOrganization).save({ userId: loggedUser, - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: loggedUser, status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -219,15 +225,15 @@ describe('query organization', () => { }); const { data } = await client.query(QUERY, { - variables: { id: 'org-1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, }); expect(data).toMatchObject({ organization: { role: 'owner', referralToken: 'ref-token-1', - referralUrl: `${process.env.COMMENTS_PREFIX}/join/organization?token=ref-token-1&orgId=org-1`, + referralUrl: `${process.env.COMMENTS_PREFIX}/join/organization?token=ref-token-1&orgId=9a212368-3388-4040-9c59-540f44c7a862`, organization: { - id: 'org-1', + id: '9a212368-3388-4040-9c59-540f44c7a862', name: 'Organization 1', seats: 1, }, @@ -252,8 +258,8 @@ describe('query organization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: loggedUser, - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: loggedUser, status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -263,8 +269,8 @@ describe('query organization', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -274,7 +280,9 @@ describe('query organization', () => { }, ]); - const { data } = await client.query(QUERY, { variables: { id: 'org-1' } }); + const { data } = await client.query(QUERY, { + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, + }); const { organization } = data.organization as GQLUserOrganization; expect(organization.members).toEqual([ @@ -316,8 +324,8 @@ describe('query organization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, createdAt: now, @@ -328,8 +336,8 @@ describe('query organization', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, createdAt: addHours(now, 1), @@ -340,8 +348,8 @@ describe('query organization', () => { }, { userId: '3', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '3', status: ContentPreferenceOrganizationStatus.Plus, createdAt: addHours(now, 2), @@ -352,8 +360,8 @@ describe('query organization', () => { }, { userId: '4', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '4', status: ContentPreferenceOrganizationStatus.Plus, createdAt: now, @@ -367,7 +375,7 @@ describe('query organization', () => { const { data, errors } = await client.query< { organization: GQLUserOrganization }, { id: string } - >(QUERY, { variables: { id: 'org-1' } }); + >(QUERY, { variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' } }); expect(errors).toBeUndefined(); expect( @@ -386,8 +394,8 @@ describe('query organization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -397,8 +405,8 @@ describe('query organization', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -408,7 +416,9 @@ describe('query organization', () => { }, ]); - const { data } = await client.query(QUERY, { variables: { id: 'org-1' } }); + const { data } = await client.query(QUERY, { + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, + }); const { organization } = data.organization as GQLUserOrganization; expect(organization.members[0].lastActive).toBeNull(); }); @@ -424,8 +434,8 @@ describe('query organization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -435,8 +445,8 @@ describe('query organization', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -453,7 +463,9 @@ describe('query organization', () => { lastActiveTimestamp.toString(), ); - const { data } = await client.query(QUERY, { variables: { id: 'org-1' } }); + const { data } = await client.query(QUERY, { + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, + }); const { organization } = data.organization as GQLUserOrganization; expect(organization.members[0].lastActive).toBe( new Date(lastActiveTimestamp).toISOString(), @@ -472,8 +484,8 @@ describe('query organization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -483,8 +495,8 @@ describe('query organization', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -494,8 +506,8 @@ describe('query organization', () => { }, { userId: '3', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '3', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -512,7 +524,9 @@ describe('query organization', () => { lastActiveTimestamp.toString(), ); - const { data } = await client.query(QUERY, { variables: { id: 'org-1' } }); + const { data } = await client.query(QUERY, { + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, + }); const { organization } = data.organization as GQLUserOrganization; // Find by user id for clarity const member2 = organization.members.find((m) => m.user.id === '2'); @@ -553,8 +567,8 @@ describe('mutation updateOrganization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -564,8 +578,8 @@ describe('mutation updateOrganization', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -579,7 +593,13 @@ describe('mutation updateOrganization', () => { it('should not authorize when not logged-in', () => testMutationErrorCode( client, - { mutation: MUTATION, variables: { id: 'org-1', name: 'New org name' } }, + { + mutation: MUTATION, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + name: 'New org name', + }, + }, 'UNAUTHENTICATED', )); @@ -611,7 +631,13 @@ describe('mutation updateOrganization', () => { testMutationErrorCode( client, - { mutation: MUTATION, variables: { id: 'org-1', name: 'New org name' } }, + { + mutation: MUTATION, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + name: 'New org name', + }, + }, 'FORBIDDEN', ); }); @@ -620,13 +646,16 @@ describe('mutation updateOrganization', () => { loggedUser = '1'; const { data } = await client.mutate(MUTATION, { - variables: { id: 'org-1', name: 'New org name' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + name: 'New org name', + }, }); expect(data).toEqual({ updateOrganization: { organization: { - id: 'org-1', + id: '9a212368-3388-4040-9c59-540f44c7a862', name: 'New org name', image: null, }, @@ -634,7 +663,7 @@ describe('mutation updateOrganization', () => { }); const updatedOrg = await con.getRepository(Organization).findOneByOrFail({ - id: 'org-1', + id: '9a212368-3388-4040-9c59-540f44c7a862', }); expect(updatedOrg.name).toBe('New org name'); }); @@ -643,7 +672,7 @@ describe('mutation updateOrganization', () => { loggedUser = '1'; const res = await client.mutate(MUTATION, { - variables: { id: 'org-1', name: null }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862', name: null }, }); const errors = res.errors!; @@ -660,7 +689,7 @@ describe('mutation updateOrganization', () => { loggedUser = '1'; const res = await client.mutate(MUTATION, { - variables: { id: 'org-1', name: ' ' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862', name: ' ' }, }); const errors = res.errors!; @@ -707,8 +736,8 @@ describe('mutation joinOrganization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -718,8 +747,8 @@ describe('mutation joinOrganization', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -733,7 +762,13 @@ describe('mutation joinOrganization', () => { it('should not authorize when not logged-in', () => testMutationErrorCode( client, - { mutation: MUTATION, variables: { id: 'org-1', token: 'ref-token-1' } }, + { + mutation: MUTATION, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + token: 'ref-token-1', + }, + }, 'UNAUTHENTICATED', )); @@ -758,7 +793,10 @@ describe('mutation joinOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', token: 'non-existing' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + token: 'non-existing', + }, }, 'FORBIDDEN', 'Invalid invitation token', @@ -772,7 +810,10 @@ describe('mutation joinOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', token: 'ref-token-2' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + token: 'ref-token-2', + }, }, 'FORBIDDEN', 'The person who invited you does not have permission to invite you to this organization.', @@ -783,13 +824,16 @@ describe('mutation joinOrganization', () => { loggedUser = '3'; const res = await client.mutate(MUTATION, { - variables: { id: 'org-1', token: 'ref-token-1' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + token: 'ref-token-1', + }, }); expect(res.data).toMatchObject({ joinOrganization: { role: 'member', organization: { - id: 'org-1', + id: '9a212368-3388-4040-9c59-540f44c7a862', name: 'Organization 1', }, }, @@ -799,18 +843,22 @@ describe('mutation joinOrganization', () => { .getRepository(ContentPreferenceOrganization) .findOneByOrFail({ userId: loggedUser, - organizationId: 'org-1', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', }); expect(contentPreference).not.toBeNull(); - expect(contentPreference.organizationId).toBe('org-1'); + expect(contentPreference.organizationId).toBe( + '9a212368-3388-4040-9c59-540f44c7a862', + ); expect(contentPreference.flags?.role).toBe(OrganizationMemberRole.Member); const user = await con.getRepository(User).findOneByOrFail({ id: loggedUser, }); - expect(user.subscriptionFlags?.organizationId).toBe('org-1'); + expect(user.subscriptionFlags?.organizationId).toBe( + '9a212368-3388-4040-9c59-540f44c7a862', + ); expect(user.subscriptionFlags?.cycle).toBe(SubscriptionCycles.Yearly); }); }); @@ -850,8 +898,8 @@ describe('query getOrganizationByIdAndInviteToken', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -861,8 +909,8 @@ describe('query getOrganizationByIdAndInviteToken', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -894,7 +942,10 @@ describe('query getOrganizationByIdAndInviteToken', () => { client, { query: QUERY, - variables: { id: 'org-1', token: 'ref-token-2' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + token: 'ref-token-2', + }, }, 'FORBIDDEN', 'The person who invited you does not have permission to invite you to this organization.', @@ -905,7 +956,10 @@ describe('query getOrganizationByIdAndInviteToken', () => { loggedUser = '3'; const res = await client.query(QUERY, { - variables: { id: 'org-1', token: 'ref-token-1' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + token: 'ref-token-1', + }, }); expect(res.data).toMatchObject({ getOrganizationByIdAndInviteToken: { @@ -914,7 +968,7 @@ describe('query getOrganizationByIdAndInviteToken', () => { name: 'Ido', }, organization: { - id: 'org-1', + id: '9a212368-3388-4040-9c59-540f44c7a862', name: 'Organization 1', }, }, @@ -923,7 +977,10 @@ describe('query getOrganizationByIdAndInviteToken', () => { it('should return organization and user who invited when not logged in', async () => { const res = await client.query(QUERY, { - variables: { id: 'org-1', token: 'ref-token-1' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + token: 'ref-token-1', + }, }); expect(res.data).toMatchObject({ getOrganizationByIdAndInviteToken: { @@ -932,7 +989,7 @@ describe('query getOrganizationByIdAndInviteToken', () => { name: 'Ido', }, organization: { - id: 'org-1', + id: '9a212368-3388-4040-9c59-540f44c7a862', name: 'Organization 1', }, }, @@ -981,8 +1038,8 @@ describe('mutation leaveOrganization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -992,8 +1049,8 @@ describe('mutation leaveOrganization', () => { }, { userId: 'org-rem-2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: 'org-rem-2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1007,7 +1064,10 @@ describe('mutation leaveOrganization', () => { it('should not authorize when not logged-in', () => testMutationErrorCode( client, - { mutation: MUTATION, variables: { id: 'org-1' } }, + { + mutation: MUTATION, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, + }, 'UNAUTHENTICATED', )); @@ -1018,7 +1078,7 @@ describe('mutation leaveOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'org-1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, }, 'NOT_FOUND', ); @@ -1031,7 +1091,7 @@ describe('mutation leaveOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'org-1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, }, 'FORBIDDEN', "Access denied! Owner can't be removed", @@ -1047,21 +1107,21 @@ describe('mutation leaveOrganization', () => { }, { subscriptionFlags: updateSubscriptionFlags({ - organizationId: 'org-1', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', cycle: 'yearly', }), }, ); await client.mutate(MUTATION, { - variables: { id: 'org-1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, }); const contentPreference = await con .getRepository(ContentPreferenceOrganization) .findOneBy({ userId: loggedUser, - organizationId: 'org-1', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', }); expect(contentPreference).toBeNull(); @@ -1090,14 +1150,14 @@ describe('mutation leaveOrganization', () => { ); await client.mutate(MUTATION, { - variables: { id: 'org-1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, }); const contentPreference = await con .getRepository(ContentPreferenceOrganization) .findOneBy({ userId: loggedUser, - organizationId: 'org-1', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', }); expect(contentPreference).toBeNull(); @@ -1140,8 +1200,8 @@ describe('mutation deleteOrganization', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1173,8 +1233,8 @@ describe('mutation deleteOrganization', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1188,7 +1248,10 @@ describe('mutation deleteOrganization', () => { it('should not authorize when not logged-in', () => testMutationErrorCode( client, - { mutation: MUTATION, variables: { id: 'org-1' } }, + { + mutation: MUTATION, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, + }, 'UNAUTHENTICATED', )); @@ -1199,7 +1262,7 @@ describe('mutation deleteOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'org-1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, }, 'NOT_FOUND', ); @@ -1212,7 +1275,7 @@ describe('mutation deleteOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'org-1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, }, 'FORBIDDEN', 'Access denied! You need to be a owner or higher to perform this action.', @@ -1226,7 +1289,7 @@ describe('mutation deleteOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'org-1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862' }, }, 'FORBIDDEN', 'Cannot delete organization with an active subscription. Please cancel the subscription first.', @@ -1312,8 +1375,8 @@ describe('mutation removeOrganizationMember', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1323,8 +1386,8 @@ describe('mutation removeOrganizationMember', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1334,8 +1397,8 @@ describe('mutation removeOrganizationMember', () => { }, { userId: '3', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '3', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1349,7 +1412,13 @@ describe('mutation removeOrganizationMember', () => { it('should not authorize when not logged-in', () => testMutationErrorCode( client, - { mutation: MUTATION, variables: { id: 'org-1', memberId: '2' } }, + { + mutation: MUTATION, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '2', + }, + }, 'UNAUTHENTICATED', )); @@ -1373,7 +1442,10 @@ describe('mutation removeOrganizationMember', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '2' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '2', + }, }, 'FORBIDDEN', 'Access denied! You need to be a admin or higher to perform this action.', @@ -1387,7 +1459,10 @@ describe('mutation removeOrganizationMember', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '1' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '1', + }, }, 'FORBIDDEN', 'You cannot remove yourself from the organization.', @@ -1401,7 +1476,10 @@ describe('mutation removeOrganizationMember', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '1' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '1', + }, }, 'FORBIDDEN', 'You cannot remove the owner of the organization.', @@ -1413,7 +1491,7 @@ describe('mutation removeOrganizationMember', () => { await con.getRepository(User).update('3', { subscriptionFlags: { - organizationId: 'org-1', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', }, }); @@ -1423,7 +1501,7 @@ describe('mutation removeOrganizationMember', () => { }, { id: string; memberId: string } >(MUTATION, { - variables: { id: 'org-1', memberId: '3' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862', memberId: '3' }, }); expect(errors).toBeUndefined(); @@ -1479,8 +1557,8 @@ describe('mutation updateOrganizationMemberRole', () => { await saveFixtures(con, ContentPreferenceOrganization, [ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1490,8 +1568,8 @@ describe('mutation updateOrganizationMemberRole', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1501,8 +1579,8 @@ describe('mutation updateOrganizationMemberRole', () => { }, { userId: '3', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '3', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1529,7 +1607,11 @@ describe('mutation updateOrganizationMemberRole', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '2', role: 'admin' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '2', + role: 'admin', + }, }, 'UNAUTHENTICATED', )); @@ -1554,7 +1636,11 @@ describe('mutation updateOrganizationMemberRole', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '4', role: 'admin' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '4', + role: 'admin', + }, }, 'NOT_FOUND', ); @@ -1567,7 +1653,11 @@ describe('mutation updateOrganizationMemberRole', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '2', role: 'admin' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '2', + role: 'admin', + }, }, 'FORBIDDEN', 'Access denied! You need to be a admin or higher to perform this action.', @@ -1581,7 +1671,11 @@ describe('mutation updateOrganizationMemberRole', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '1', role: 'admin' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '1', + role: 'admin', + }, }, 'FORBIDDEN', 'You cannot change your own role in the organization.', @@ -1595,7 +1689,11 @@ describe('mutation updateOrganizationMemberRole', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '1', role: 'admin' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '1', + role: 'admin', + }, }, 'FORBIDDEN', 'You cannot change the role of the owner of the organization.', @@ -1609,7 +1707,11 @@ describe('mutation updateOrganizationMemberRole', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '3', role: 'owner' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '3', + role: 'owner', + }, }, 'FORBIDDEN', 'You cannot assign the owner role to a member at this time.', @@ -1623,7 +1725,11 @@ describe('mutation updateOrganizationMemberRole', () => { { updateOrganizationMemberRole: GQLUserOrganization }, { id: string; memberId: string; role: string } >(MUTATION, { - variables: { id: 'org-1', memberId: '3', role: 'admin' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '3', + role: 'admin', + }, }); expect(errors).toBeUndefined(); @@ -1652,7 +1758,11 @@ describe('mutation updateOrganizationMemberRole', () => { { updateOrganizationMemberRole: GQLUserOrganization }, { id: string; memberId: string; role: string } >(MUTATION, { - variables: { id: 'org-1', memberId: '2', role: 'member' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '2', + role: 'member', + }, }); expect(errors).toBeUndefined(); @@ -1718,8 +1828,8 @@ describe('mutation toggleOrganizationMemberSeat', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1729,8 +1839,8 @@ describe('mutation toggleOrganizationMemberSeat', () => { }, { userId: '2', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '2', status: ContentPreferenceOrganizationStatus.Free, flags: { @@ -1740,8 +1850,8 @@ describe('mutation toggleOrganizationMemberSeat', () => { }, { userId: '3', - referenceId: 'org-1', - organizationId: 'org-1', + referenceId: '9a212368-3388-4040-9c59-540f44c7a862', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', feedId: '3', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1768,7 +1878,10 @@ describe('mutation toggleOrganizationMemberSeat', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '2' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '2', + }, }, 'UNAUTHENTICATED', )); @@ -1793,7 +1906,10 @@ describe('mutation toggleOrganizationMemberSeat', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '4' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '4', + }, }, 'NOT_FOUND', ); @@ -1806,7 +1922,10 @@ describe('mutation toggleOrganizationMemberSeat', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '1' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '1', + }, }, 'FORBIDDEN', 'Access denied! You need to be a admin or higher to perform this action.', @@ -1827,7 +1946,10 @@ describe('mutation toggleOrganizationMemberSeat', () => { client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '2' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '2', + }, }, 'FORBIDDEN', 'You cannot toggle the seat of a member who has a Plus subscription from outside the organization.', @@ -1837,15 +1959,20 @@ describe('mutation toggleOrganizationMemberSeat', () => { it('should return forbidden when trying to assign seat when no seats are available', async () => { loggedUser = '1'; - await con.getRepository(Organization).update('org-1', { - seats: 1, - }); + await con + .getRepository(Organization) + .update('9a212368-3388-4040-9c59-540f44c7a862', { + seats: 1, + }); await testMutationErrorCode( client, { mutation: MUTATION, - variables: { id: 'org-1', memberId: '2' }, + variables: { + id: '9a212368-3388-4040-9c59-540f44c7a862', + memberId: '2', + }, }, 'FORBIDDEN', 'You cannot assign a seat to a member when the organization has reached its maximum number of seats.', @@ -1855,13 +1982,15 @@ describe('mutation toggleOrganizationMemberSeat', () => { it('should assign seat to member when seats are available', async () => { loggedUser = '1'; - await con.getRepository(Organization).update('org-1', { - seats: 5, - }); + await con + .getRepository(Organization) + .update('9a212368-3388-4040-9c59-540f44c7a862', { + seats: 5, + }); await con.getRepository(User).update('3', { subscriptionFlags: updateSubscriptionFlags({ - organizationId: 'org-1', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', cycle: 'yearly', }), }); @@ -1870,7 +1999,7 @@ describe('mutation toggleOrganizationMemberSeat', () => { { toggleOrganizationMemberSeat: GQLUserOrganization }, { id: string; memberId: string } >(MUTATION, { - variables: { id: 'org-1', memberId: '2' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862', memberId: '2' }, }); expect(errors).toBeUndefined(); @@ -1902,13 +2031,15 @@ describe('mutation toggleOrganizationMemberSeat', () => { it('should remove seat from member when seats are available', async () => { loggedUser = '1'; - await con.getRepository(Organization).update('org-1', { - seats: 5, - }); + await con + .getRepository(Organization) + .update('9a212368-3388-4040-9c59-540f44c7a862', { + seats: 5, + }); await con.getRepository(User).update('3', { subscriptionFlags: updateSubscriptionFlags({ - organizationId: 'org-1', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', cycle: 'yearly', }), }); @@ -1917,7 +2048,7 @@ describe('mutation toggleOrganizationMemberSeat', () => { { toggleOrganizationMemberSeat: GQLUserOrganization }, { id: string; memberId: string } >(MUTATION, { - variables: { id: 'org-1', memberId: '3' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862', memberId: '3' }, }); console.log(JSON.stringify(data.toggleOrganizationMemberSeat, null, 2)); @@ -1951,9 +2082,11 @@ describe('mutation toggleOrganizationMemberSeat', () => { it('should assign seat to self when not a seat user', async () => { loggedUser = '1'; - await con.getRepository(Organization).update('org-1', { - seats: 5, - }); + await con + .getRepository(Organization) + .update('9a212368-3388-4040-9c59-540f44c7a862', { + seats: 5, + }); await con.getRepository(User).update( { @@ -1961,7 +2094,7 @@ describe('mutation toggleOrganizationMemberSeat', () => { }, { subscriptionFlags: updateSubscriptionFlags({ - organizationId: 'org-1', + organizationId: '9a212368-3388-4040-9c59-540f44c7a862', cycle: 'yearly', }), }, @@ -1971,7 +2104,7 @@ describe('mutation toggleOrganizationMemberSeat', () => { { toggleOrganizationMemberSeat: GQLUserOrganization }, { id: string; memberId: string } >(MUTATION, { - variables: { id: 'org-1', memberId: '1' }, + variables: { id: '9a212368-3388-4040-9c59-540f44c7a862', memberId: '1' }, }); expect(errors).toBeUndefined(); diff --git a/__tests__/private.ts b/__tests__/private.ts index 941b2246d8..1ad423cac8 100644 --- a/__tests__/private.ts +++ b/__tests__/private.ts @@ -1093,7 +1093,7 @@ describe('POST /p/newOpportunity', () => { beforeEach(async () => { await saveFixtures(con, Organization, [ { - id: 'org-1', + id: '14e9a766-1d22-4b90-8929-7876e315c06a', seats: 1, name: 'Organization 1', subscriptionFlags: { @@ -1133,7 +1133,7 @@ describe('POST /p/newOpportunity', () => { const opportunityData = { title: 'Senior Software Engineer', tldr: 'Join our team to build amazing products', - organizationId: 'org-1', + organizationId: '14e9a766-1d22-4b90-8929-7876e315c06a', keywords: [ { keyword: 'javascript' }, { keyword: 'typescript' }, @@ -1174,7 +1174,9 @@ describe('POST /p/newOpportunity', () => { expect(opportunity?.tldr).toEqual( 'Join our team to build amazing products', ); - expect(opportunity?.organizationId).toEqual('org-1'); + expect(opportunity?.organizationId).toEqual( + '14e9a766-1d22-4b90-8929-7876e315c06a', + ); expect(opportunity?.state).toEqual(1); expect(opportunity?.type).toEqual(1); @@ -1201,7 +1203,7 @@ describe('POST /p/newOpportunity', () => { const opportunityData = { title: 'Backend Engineer', tldr: 'Work on distributed systems', - organizationId: 'org-1', + organizationId: '14e9a766-1d22-4b90-8929-7876e315c06a', keywords: [{ keyword: 'golang' }, { keyword: 'kubernetes' }], meta: { employmentType: 1, diff --git a/__tests__/workers/cdc/primary.ts b/__tests__/workers/cdc/primary.ts index f4a8ac4eef..8d9f2a74d8 100644 --- a/__tests__/workers/cdc/primary.ts +++ b/__tests__/workers/cdc/primary.ts @@ -6298,7 +6298,7 @@ describe('opportunity', () => { content: [], meta: {}, state: OpportunityState.DRAFT, - organizationId: 'org-1', + organizationId: 'b76a7a19-e9c6-4651-8c2a-a51c33219793', }, op: 'c', table: 'opportunity', @@ -6322,7 +6322,7 @@ describe('opportunity', () => { content: [], meta: {}, state: OpportunityState.LIVE, - organizationId: 'org-1', + organizationId: 'b76a7a19-e9c6-4651-8c2a-a51c33219793', }, op: 'c', table: 'opportunity', @@ -6346,7 +6346,7 @@ describe('opportunity', () => { content: [], meta: {}, state: OpportunityState.LIVE, - organizationId: 'org-1', + organizationId: 'b76a7a19-e9c6-4651-8c2a-a51c33219793', }, op: 'u', table: 'opportunity', @@ -6373,7 +6373,7 @@ describe('opportunity', () => { content: [], meta: {}, state: OpportunityState.DRAFT, - organizationId: 'org-1', + organizationId: 'b76a7a19-e9c6-4651-8c2a-a51c33219793', }, op: 'u', table: 'opportunity', @@ -6397,7 +6397,7 @@ describe('opportunity', () => { content: [], meta: {}, state: OpportunityState.LIVE, - organizationId: 'org-1', + organizationId: 'b76a7a19-e9c6-4651-8c2a-a51c33219793', }, op: 'u', table: 'opportunity', @@ -6435,7 +6435,7 @@ describe('opportunity', () => { content: [], meta: {}, state: OpportunityState.DRAFT, - organizationId: 'org-1', + organizationId: 'b76a7a19-e9c6-4651-8c2a-a51c33219793', }, op: 'u', table: 'opportunity', diff --git a/__tests__/workers/organization/organizationUserLeft.ts b/__tests__/workers/organization/organizationUserLeft.ts index 5ac288a9d0..904689be12 100644 --- a/__tests__/workers/organization/organizationUserLeft.ts +++ b/__tests__/workers/organization/organizationUserLeft.ts @@ -38,7 +38,7 @@ describe('organizationUserLeft worker', () => { await saveFixtures(con, Organization, [ { - id: 'our-org-1', + id: '1cf163f2-8099-41c7-841a-8aaace2513be', seats: 1, name: 'Organization 1', subscriptionFlags: { @@ -47,7 +47,7 @@ describe('organizationUserLeft worker', () => { }, }, { - id: 'our-org-2', + id: 'c1226c42-fa24-4007-a990-91af8dab75a0', seats: 1, name: 'Organization 2', subscriptionFlags: { @@ -71,8 +71,8 @@ describe('organizationUserLeft worker', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'our-org-1', - organizationId: 'our-org-1', + referenceId: '1cf163f2-8099-41c7-841a-8aaace2513be', + organizationId: '1cf163f2-8099-41c7-841a-8aaace2513be', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -82,8 +82,8 @@ describe('organizationUserLeft worker', () => { }, { userId: '2', - referenceId: 'our-org-1', - organizationId: 'our-org-1', + referenceId: '1cf163f2-8099-41c7-841a-8aaace2513be', + organizationId: '1cf163f2-8099-41c7-841a-8aaace2513be', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -93,8 +93,8 @@ describe('organizationUserLeft worker', () => { }, { userId: '2', - referenceId: 'our-org-2', - organizationId: 'our-org-2', + referenceId: 'c1226c42-fa24-4007-a990-91af8dab75a0', + organizationId: 'c1226c42-fa24-4007-a990-91af8dab75a0', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -134,7 +134,7 @@ describe('organizationUserLeft worker', () => { const warnSpy = jest.spyOn(logger, 'error'); await expectSuccessfulTypedBackground(worker, { - organizationId: 'our-org-1', + organizationId: '1cf163f2-8099-41c7-841a-8aaace2513be', memberId: '87b79108-d258-42d2-b38a-4a02974746cc', }); @@ -151,14 +151,14 @@ describe('organizationUserLeft worker', () => { const warnSpy = jest.spyOn(logger, 'error'); await expectSuccessfulTypedBackground(worker, { - organizationId: 'our-org-2', + organizationId: 'c1226c42-fa24-4007-a990-91af8dab75a0', memberId: '2', }); expect(sendEmail).not.toHaveBeenCalled(); expect(warnSpy).toHaveBeenCalledWith( { - organizationId: 'our-org-2', + organizationId: 'c1226c42-fa24-4007-a990-91af8dab75a0', userId: '2', }, 'No owner found for organization', @@ -169,7 +169,7 @@ describe('organizationUserLeft worker', () => { const user = usersFixture[0]; await expectSuccessfulTypedBackground(worker, { - organizationId: 'our-org-1', + organizationId: '1cf163f2-8099-41c7-841a-8aaace2513be', memberId: '1', }); @@ -181,7 +181,9 @@ describe('organizationUserLeft worker', () => { message_data: { organization: { name: 'Organization 1', - href: getOrganizationPermalink({ id: 'our-org-1' }), + href: getOrganizationPermalink({ + id: '1cf163f2-8099-41c7-841a-8aaace2513be', + }), }, member: { name: user.name, diff --git a/__tests__/workers/organization/organizationUserRemoved.ts b/__tests__/workers/organization/organizationUserRemoved.ts index 1c509c61ca..326201f68f 100644 --- a/__tests__/workers/organization/organizationUserRemoved.ts +++ b/__tests__/workers/organization/organizationUserRemoved.ts @@ -37,7 +37,7 @@ describe('organizationUserRemoved worker', () => { await saveFixtures(con, Organization, [ { - id: 'our-org-1', + id: '8d02f0a0-6c44-40e9-9c40-80bc8e8cc2e8', seats: 1, name: 'Organization 1', subscriptionFlags: { @@ -46,7 +46,7 @@ describe('organizationUserRemoved worker', () => { }, }, { - id: 'our-org-2', + id: '2b243220-ca5a-44c5-957e-47743243e995', seats: 1, name: 'Organization 2', subscriptionFlags: { @@ -70,8 +70,8 @@ describe('organizationUserRemoved worker', () => { await con.getRepository(ContentPreferenceOrganization).save([ { userId: '1', - referenceId: 'our-org-1', - organizationId: 'our-org-1', + referenceId: '8d02f0a0-6c44-40e9-9c40-80bc8e8cc2e8', + organizationId: '8d02f0a0-6c44-40e9-9c40-80bc8e8cc2e8', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -81,8 +81,8 @@ describe('organizationUserRemoved worker', () => { }, { userId: '2', - referenceId: 'our-org-1', - organizationId: 'our-org-1', + referenceId: '8d02f0a0-6c44-40e9-9c40-80bc8e8cc2e8', + organizationId: '8d02f0a0-6c44-40e9-9c40-80bc8e8cc2e8', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -92,8 +92,8 @@ describe('organizationUserRemoved worker', () => { }, { userId: '2', - referenceId: 'our-org-2', - organizationId: 'our-org-2', + referenceId: '2b243220-ca5a-44c5-957e-47743243e995', + organizationId: '2b243220-ca5a-44c5-957e-47743243e995', feedId: '2', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -133,7 +133,7 @@ describe('organizationUserRemoved worker', () => { const warnSpy = jest.spyOn(logger, 'error'); await expectSuccessfulTypedBackground(worker, { - organizationId: 'our-org-1', + organizationId: '8d02f0a0-6c44-40e9-9c40-80bc8e8cc2e8', memberId: '87b79108-d258-42d2-b38a-4a02974746cc', }); @@ -150,7 +150,7 @@ describe('organizationUserRemoved worker', () => { const user = usersFixture[0]; await expectSuccessfulTypedBackground(worker, { - organizationId: 'our-org-1', + organizationId: '8d02f0a0-6c44-40e9-9c40-80bc8e8cc2e8', memberId: '1', }); From 621f0dff28eb92027c9d4f2c45a5fd1347b89a81 Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:13:06 +0100 Subject: [PATCH 4/7] fix: more orgs --- __tests__/organizations.ts | 54 ++++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 19 deletions(-) diff --git a/__tests__/organizations.ts b/__tests__/organizations.ts index 760971b167..f7fce1c66d 100644 --- a/__tests__/organizations.ts +++ b/__tests__/organizations.ts @@ -60,7 +60,7 @@ beforeEach(async () => { }, }, { - id: 'org-2', + id: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', seats: 2, name: 'Organization 2', subscriptionFlags: { @@ -69,7 +69,7 @@ beforeEach(async () => { }, }, { - id: 'org-3', + id: '42ce1d83-9ce4-4d97-b175-fd082d95a2c4', seats: 5, name: 'Organization 3', subscriptionFlags: { @@ -621,7 +621,13 @@ describe('mutation updateOrganization', () => { testMutationErrorCode( client, - { mutation: MUTATION, variables: { id: 'org-2', name: 'New org name' } }, + { + mutation: MUTATION, + variables: { + id: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', + name: 'New org name', + }, + }, 'NOT_FOUND', ); }); @@ -1211,8 +1217,8 @@ describe('mutation deleteOrganization', () => { }, { userId: '1', - referenceId: 'org-2', - organizationId: 'org-2', + referenceId: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', + organizationId: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', feedId: '1', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1222,8 +1228,8 @@ describe('mutation deleteOrganization', () => { }, { userId: '1', - referenceId: 'org-3', - organizationId: 'org-3', + referenceId: '42ce1d83-9ce4-4d97-b175-fd082d95a2c4', + organizationId: '42ce1d83-9ce4-4d97-b175-fd082d95a2c4', feedId: '1', status: ContentPreferenceOrganizationStatus.Free, flags: { @@ -1303,7 +1309,7 @@ describe('mutation deleteOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'org-2' }, + variables: { id: '5d7a9ee0-a095-44df-8a2c-6915af60ece2' }, }, 'FORBIDDEN', 'Cannot delete organization with Plus members. Please remove all Plus members first.', @@ -1314,7 +1320,7 @@ describe('mutation deleteOrganization', () => { loggedUser = '1'; const { data, errors } = await client.mutate(MUTATION, { - variables: { id: 'org-3' }, + variables: { id: '42ce1d83-9ce4-4d97-b175-fd082d95a2c4' }, }); expect(errors).toBeUndefined(); @@ -1325,7 +1331,7 @@ describe('mutation deleteOrganization', () => { }); const org = await con.getRepository(Organization).findOneBy({ - id: 'org-3', + id: '42ce1d83-9ce4-4d97-b175-fd082d95a2c4', }); expect(org).toBeNull(); @@ -1333,7 +1339,7 @@ describe('mutation deleteOrganization', () => { .getRepository(ContentPreferenceOrganization) .findOneBy({ userId: loggedUser, - organizationId: 'org-3', + organizationId: '42ce1d83-9ce4-4d97-b175-fd082d95a2c4', }); expect(contentPreference).toBeNull(); }); @@ -1429,7 +1435,10 @@ describe('mutation removeOrganizationMember', () => { client, { mutation: MUTATION, - variables: { id: 'org-2', memberId: '2' }, + variables: { + id: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', + memberId: '2', + }, }, 'NOT_FOUND', ); @@ -1590,8 +1599,8 @@ describe('mutation updateOrganizationMemberRole', () => { }, { userId: '4', - referenceId: 'org-2', - organizationId: 'org-2', + referenceId: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', + organizationId: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', feedId: '4', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1623,7 +1632,11 @@ describe('mutation updateOrganizationMemberRole', () => { client, { mutation: MUTATION, - variables: { id: 'org-2', memberId: '2', role: 'admin' }, + variables: { + id: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', + memberId: '2', + role: 'admin', + }, }, 'NOT_FOUND', ); @@ -1861,8 +1874,8 @@ describe('mutation toggleOrganizationMemberSeat', () => { }, { userId: '4', - referenceId: 'org-2', - organizationId: 'org-2', + referenceId: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', + organizationId: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', feedId: '4', status: ContentPreferenceOrganizationStatus.Plus, flags: { @@ -1893,7 +1906,10 @@ describe('mutation toggleOrganizationMemberSeat', () => { client, { mutation: MUTATION, - variables: { id: 'org-2', memberId: '2' }, + variables: { + id: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', + memberId: '2', + }, }, 'NOT_FOUND', ); @@ -1937,7 +1953,7 @@ describe('mutation toggleOrganizationMemberSeat', () => { await con.getRepository(User).update('2', { subscriptionFlags: updateSubscriptionFlags({ - organizationId: 'org-2', + organizationId: '5d7a9ee0-a095-44df-8a2c-6915af60ece2', cycle: 'yearly', }), }); From 3b51ff314202ad0b4dee8521749ad1c478f43a44 Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:13:46 +0100 Subject: [PATCH 5/7] fix: and more --- __tests__/workers/notifications/warmIntroNotification.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/__tests__/workers/notifications/warmIntroNotification.ts b/__tests__/workers/notifications/warmIntroNotification.ts index a88e4678cd..b303af211e 100644 --- a/__tests__/workers/notifications/warmIntroNotification.ts +++ b/__tests__/workers/notifications/warmIntroNotification.ts @@ -42,7 +42,7 @@ describe('warmIntroNotification worker', () => { it('should send notification with all required fields', async () => { const organization = await con.getRepository(Organization).save({ - id: 'org123', + id: 'e34d0a84-89ea-4ba3-ba6e-1b8fe9ac952f', name: 'Test Organization', image: 'https://example.com/org.png', }); @@ -102,7 +102,7 @@ describe('warmIntroNotification worker', () => { ); expect(context.organization).toEqual( expect.objectContaining({ - id: 'org123', + id: 'e34d0a84-89ea-4ba3-ba6e-1b8fe9ac952f', name: 'Test Organization', image: 'https://example.com/org.png', }), From 260d3bda427718ed234b389eb4b998d8a429f949 Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:22:43 +0100 Subject: [PATCH 6/7] fix: moooooore --- __tests__/organizations.ts | 2 -- __tests__/workers/notifications/warmIntroNotification.ts | 8 ++++---- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/__tests__/organizations.ts b/__tests__/organizations.ts index f7fce1c66d..e97ae7f3e4 100644 --- a/__tests__/organizations.ts +++ b/__tests__/organizations.ts @@ -2067,8 +2067,6 @@ describe('mutation toggleOrganizationMemberSeat', () => { variables: { id: '9a212368-3388-4040-9c59-540f44c7a862', memberId: '3' }, }); - console.log(JSON.stringify(data.toggleOrganizationMemberSeat, null, 2)); - expect(errors).toBeUndefined(); expect(data.toggleOrganizationMemberSeat.organization.activeSeats).toEqual( 1, diff --git a/__tests__/workers/notifications/warmIntroNotification.ts b/__tests__/workers/notifications/warmIntroNotification.ts index b303af211e..505bbbc408 100644 --- a/__tests__/workers/notifications/warmIntroNotification.ts +++ b/__tests__/workers/notifications/warmIntroNotification.ts @@ -111,7 +111,7 @@ describe('warmIntroNotification worker', () => { it('should handle missing recruiter gracefully', async () => { const organization = await con.getRepository(Organization).save({ - id: 'org456', + id: '0672bc0f-93c0-43a0-ad8a-ca6ba89428d4', name: 'Another Organization', image: 'https://example.com/another-org.png', }); @@ -151,7 +151,7 @@ describe('warmIntroNotification worker', () => { expect(context.recruiter).toBeUndefined(); expect(context.organization).toEqual( expect.objectContaining({ - id: 'org456', + id: '0672bc0f-93c0-43a0-ad8a-ca6ba89428d4', name: 'Another Organization', }), ); @@ -173,7 +173,7 @@ describe('warmIntroNotification worker', () => { it('should handle missing optional description', async () => { const organization = await con.getRepository(Organization).save({ - id: 'org789', + id: 'c6d40f37-af7e-43ba-af90-9f31d6645037', name: 'Test Org', }); @@ -212,7 +212,7 @@ describe('warmIntroNotification worker', () => { it('should convert markdown description to HTML in applicationRank', async () => { const organization = await con.getRepository(Organization).save({ - id: 'org999', + id: '439c472a-b339-4d47-8a75-6f8669c56d27', name: 'Test Company', }); From 534692716e83aa05f3a544b8b3daabfd1f094bef Mon Sep 17 00:00:00 2001 From: Ole-Martin Bratteng <1681525+omBratteng@users.noreply.github.com> Date: Thu, 30 Oct 2025 15:26:56 +0100 Subject: [PATCH 7/7] fix: non-existing uuid --- __tests__/organizations.ts | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/__tests__/organizations.ts b/__tests__/organizations.ts index e97ae7f3e4..3af82f05ad 100644 --- a/__tests__/organizations.ts +++ b/__tests__/organizations.ts @@ -186,7 +186,10 @@ describe('query organization', () => { testQueryErrorCode( client, - { query: QUERY, variables: { id: 'non-existing' } }, + { + query: QUERY, + variables: { id: '00000000-0000-0000-0000-000000000000' }, + }, 'NOT_FOUND', ); }); @@ -610,7 +613,10 @@ describe('mutation updateOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'non-existing', name: 'New org name' }, + variables: { + id: '00000000-0000-0000-0000-000000000000', + name: 'New org name', + }, }, 'NOT_FOUND', ); @@ -785,7 +791,10 @@ describe('mutation joinOrganization', () => { client, { mutation: MUTATION, - variables: { id: 'non-existing', token: 'ref-token-1' }, + variables: { + id: '00000000-0000-0000-0000-000000000000', + token: 'ref-token-1', + }, }, 'FORBIDDEN', 'Invalid invitation token', @@ -801,7 +810,7 @@ describe('mutation joinOrganization', () => { mutation: MUTATION, variables: { id: '9a212368-3388-4040-9c59-540f44c7a862', - token: 'non-existing', + token: '00000000-0000-0000-0000-000000000000', }, }, 'FORBIDDEN', @@ -934,7 +943,10 @@ describe('query getOrganizationByIdAndInviteToken', () => { client, { query: QUERY, - variables: { id: 'non-existing', token: 'ref-token-1' }, + variables: { + id: '00000000-0000-0000-0000-000000000000', + token: 'ref-token-1', + }, }, 'FORBIDDEN', 'Invalid invitation token',