-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #102 from vbihun/feature/team-onboarding-spotlight
Team onboarding spotlight
- Loading branch information
Showing
13 changed files
with
586 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* eslint-disable import/order */ | ||
import { storage, mockForgeApi } from '../__tests__/helpers/forge-helper'; | ||
/* eslint-disable import/first */ | ||
|
||
mockForgeApi(); | ||
|
||
import { STORAGE_KEYS } from '../constants'; | ||
import { getTeamOnboarding, setTeamOnboarding } from './onboarding'; | ||
|
||
const accountId = 'test-account-id'; | ||
|
||
describe('getTeamOnboarding', () => { | ||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
it('returns true in case if onboarding is completed', async () => { | ||
storage.get.mockResolvedValue(true); | ||
|
||
const result = await getTeamOnboarding(accountId); | ||
|
||
expect(result).toEqual(true); | ||
expect(storage.get).toBeCalledWith(`${STORAGE_KEYS.TEAM_ONBOARDING}:${accountId}`); | ||
}); | ||
|
||
it('returns false in case if onboarding is not completed', async () => { | ||
storage.get.mockResolvedValue(false); | ||
|
||
const result = await getTeamOnboarding(accountId); | ||
|
||
expect(result).toEqual(false); | ||
expect(storage.get).toBeCalledWith(`${STORAGE_KEYS.TEAM_ONBOARDING}:${accountId}`); | ||
}); | ||
}); | ||
|
||
describe('setTeamOnboarding', () => { | ||
beforeEach(() => { | ||
jest.resetAllMocks(); | ||
}); | ||
|
||
it('save to the storage onboarding value', async () => { | ||
await setTeamOnboarding(accountId); | ||
|
||
expect(storage.set).toBeCalledWith(`${STORAGE_KEYS.TEAM_ONBOARDING}:${accountId}`, true); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { storage } from '@forge/api'; | ||
import { STORAGE_KEYS } from '../constants'; | ||
|
||
export const getTeamOnboarding = async (accountId: string): Promise<boolean> => { | ||
const isTeamOnboardingCompleted = await storage.get(`${STORAGE_KEYS.TEAM_ONBOARDING}:${accountId}`); | ||
|
||
return isTeamOnboardingCompleted ?? false; | ||
}; | ||
|
||
export const setTeamOnboarding = async (accountId: string): Promise<void> => { | ||
await storage.set(`isTeamOnboardingCompleted:${accountId}`, true); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.