From 9649c4cc4ff3205de205454c1de5e8fcb106ae44 Mon Sep 17 00:00:00 2001 From: Anze Demsar Date: Fri, 21 Jun 2024 14:38:11 +0200 Subject: [PATCH] update test after making log ascents private --- src/activities/services/activities.service.ts | 4 +--- test/e2e/activity.e2e-spec.ts | 13 ++++++------- 2 files changed, 7 insertions(+), 10 deletions(-) diff --git a/src/activities/services/activities.service.ts b/src/activities/services/activities.service.ts index 6e3088a..933d32f 100644 --- a/src/activities/services/activities.service.ts +++ b/src/activities/services/activities.service.ts @@ -219,7 +219,6 @@ export class ActivitiesService { params: FindActivitiesInput = {}, currentUser: User = null, ): Promise { - const builder = this.activitiesRepository .createQueryBuilder('ac') .select('EXTRACT(YEAR FROM ac.date)', 'year') @@ -247,7 +246,6 @@ export class ActivitiesService { } as StatsActivities; }); return myStats; - } async find(params: FindActivitiesInput = {}): Promise { @@ -326,7 +324,7 @@ export class ActivitiesService { ActivityRoute, 'ar', 'ar.activity_id = a.id AND (ar."publish" IN (:...publish))', - { publish: ['log', 'public'] }, + { publish: ['public'] }, ); // Allow/disallow based on publishStatus of contained activity routes diff --git a/test/e2e/activity.e2e-spec.ts b/test/e2e/activity.e2e-spec.ts index a1579af..ccc7464 100644 --- a/test/e2e/activity.e2e-spec.ts +++ b/test/e2e/activity.e2e-spec.ts @@ -276,7 +276,7 @@ describe('Activity', () => { expect(activitiesIds).not.toContain(mockData.activities.nonCragActivity.id); }); - it('should get only public (or log) activity routes and only activities containing at least one public (or log) activity route when fetching as a guest', async () => { + it('should get only public activity routes and only activities containing at least one public activity route when fetching as a guest', async () => { const response = await request(app.getHttpServer()) .post('/graphql') .send({ @@ -304,14 +304,13 @@ describe('Activity', () => { const numOfNonPublicActivityRoutes = response.body.data.activities.items.filter( (a) => - a.routes.filter((ar) => !['log', 'public'].includes(ar.publish)) - .length > 0, + a.routes.filter((ar) => !['public'].includes(ar.publish)).length > 0, ).length; expect(numOfNonPublicActivityRoutes).toEqual(0); const numOfActivitiesWithNoPublicActivityRoutes = response.body.data.activities.items.filter( - (a) => !a.routes.some((ar) => ['log', 'public'].includes(ar.publish)), + (a) => !a.routes.some((ar) => ['public'].includes(ar.publish)), ).length; expect(numOfActivitiesWithNoPublicActivityRoutes).toEqual(0); @@ -320,7 +319,7 @@ describe('Activity', () => { const returnedActivitiesIds = response.body.data.activities.items.map( (a) => a.id, ); - expect(returnedActivitiesIds).toContain( + expect(returnedActivitiesIds).not.toContain( mockData.activities.activityWithLogRoutes.id, ); expect(returnedActivitiesIds).toContain( @@ -340,7 +339,7 @@ describe('Activity', () => { mockData.activities.activityWithPublicRoutes.activityRoutes .publicActivityRoute.id, ); - expect(returnedActivityRoutesIds).toContain( + expect(returnedActivityRoutesIds).not.toContain( mockData.activities.activityWithLogRoutes.activityRoutes.logActivityRoute .id, ); @@ -348,7 +347,7 @@ describe('Activity', () => { mockData.activities.activityWithMixedRoutes.activityRoutes .publicActivityRoute.id, ); - expect(returnedActivityRoutesIds).toContain( + expect(returnedActivityRoutesIds).not.toContain( mockData.activities.activityWithMixedRoutes.activityRoutes .logActivityRoute.id, );