From e8e005daa4edb6081a13f91872edf6f3a42e53b8 Mon Sep 17 00:00:00 2001 From: Jaanus Sellin Date: Thu, 3 Oct 2024 13:01:45 +0300 Subject: [PATCH] feat: archived features will be included in onboarding (#8350) Now when you are finished onboarding and you archive feature, you will not restart onboarding. --- .../onboarding/onboarding-read-model.test.ts | 27 ++++++++++++++++++- .../onboarding/onboarding-read-model.ts | 1 - 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/src/lib/features/onboarding/onboarding-read-model.test.ts b/src/lib/features/onboarding/onboarding-read-model.test.ts index 2b9d1c560288..390d21f6a043 100644 --- a/src/lib/features/onboarding/onboarding-read-model.test.ts +++ b/src/lib/features/onboarding/onboarding-read-model.test.ts @@ -30,7 +30,9 @@ afterAll(async () => { } }); -beforeEach(async () => {}); +beforeEach(async () => { + await featureToggleStore.deleteAll(); +}); test('can get instance onboarding durations', async () => { const initialResult = @@ -153,3 +155,26 @@ test('can get project onboarding status', async () => { status: 'onboarded', }); }); + +test('archived feature counts as onboarded', async () => { + await featureToggleStore.create('default', { + name: 'my-flag', + createdByUserId: SYSTEM_USER.id, + }); + + await lastSeenStore.setLastSeen([ + { + environment: 'default', + featureName: 'my-flag', + }, + ]); + + await featureToggleStore.archive('my-flag'); + + const onboardedResult = + await onboardingReadModel.getOnboardingStatusForProject('default'); + + expect(onboardedResult).toMatchObject({ + status: 'onboarded', + }); +}); diff --git a/src/lib/features/onboarding/onboarding-read-model.ts b/src/lib/features/onboarding/onboarding-read-model.ts index 285407389c9c..a124e520c3ac 100644 --- a/src/lib/features/onboarding/onboarding-read-model.ts +++ b/src/lib/features/onboarding/onboarding-read-model.ts @@ -86,7 +86,6 @@ export class OnboardingReadModel implements IOnboardingReadModel { const feature = await this.db('features') .select('name') .where('project', projectId) - .where('archived_at', null) .first(); if (!feature) {