bigbuffet-rw/app/soapbox/actions/__tests__/onboarding.test.ts

25 lines
907 B
TypeScript
Raw Normal View History

import { getSettings } from 'soapbox/actions/settings';
import { createTestStore, rootState } from 'soapbox/jest/test-helpers';
2022-04-12 06:51:28 -07:00
import { ONBOARDING_VERSION, endOnboarding } from '../onboarding';
2022-04-12 06:51:28 -07:00
describe('endOnboarding()', () => {
it('updates the onboardingVersion setting', async() => {
const store = createTestStore(rootState);
2022-04-12 06:51:28 -07:00
// Sanity check:
// `onboardingVersion` should be `0` by default
const initialVersion = getSettings(store.getState()).get('onboardingVersion');
expect(initialVersion).toBe(0);
2022-04-12 06:51:28 -07:00
await store.dispatch(endOnboarding());
// After dispatching, `onboardingVersion` is updated
const updatedVersion = getSettings(store.getState()).get('onboardingVersion');
expect(updatedVersion).toBe(ONBOARDING_VERSION);
// Sanity check: `updatedVersion` is greater than `initialVersion`
expect(updatedVersion > initialVersion).toBe(true);
2022-04-12 06:51:28 -07:00
});
});