feat(tutorial): enhance tutorial flow and add tests for help button functionality
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
Chore App Build, Test, and Push Docker Images / build-and-push (push) Has been cancelled
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
import { describe, it, expect, beforeEach } from 'vitest'
|
||||
import {
|
||||
shouldShowStep,
|
||||
clearChainProgress,
|
||||
tutorialEnabled,
|
||||
tutorialProgress,
|
||||
sessionSkipped,
|
||||
} from '../controller'
|
||||
|
||||
describe('tutorial controller - shouldShowStep', () => {
|
||||
beforeEach(() => {
|
||||
tutorialEnabled.value = true
|
||||
tutorialProgress.value = {}
|
||||
sessionSkipped.value = false
|
||||
})
|
||||
|
||||
it('returns true when tips are enabled, the step is unseen, and the session is not skipped', () => {
|
||||
expect(shouldShowStep('create-chore')).toBe(true)
|
||||
})
|
||||
|
||||
it('returns false when tips are disabled for a normal step', () => {
|
||||
tutorialEnabled.value = false
|
||||
expect(shouldShowStep('create-penalty')).toBe(false)
|
||||
})
|
||||
|
||||
it('returns true for a locally-cleared step even when tips are disabled', () => {
|
||||
tutorialEnabled.value = false
|
||||
clearChainProgress('create-reward')
|
||||
expect(shouldShowStep('create-reward')).toBe(true)
|
||||
})
|
||||
|
||||
it('still blocks locally-cleared steps when the session has been skipped', () => {
|
||||
tutorialEnabled.value = false
|
||||
sessionSkipped.value = true
|
||||
clearChainProgress('create-kindness')
|
||||
expect(shouldShowStep('create-kindness')).toBe(false)
|
||||
})
|
||||
|
||||
it('returns false when the step has already been seen', () => {
|
||||
tutorialProgress.value = { 'notification-click': true }
|
||||
expect(shouldShowStep('notification-click')).toBe(false)
|
||||
})
|
||||
|
||||
it('ignores the enabled flag when ignoreEnabled is true', () => {
|
||||
tutorialEnabled.value = false
|
||||
expect(shouldShowStep('status-pending', true)).toBe(true)
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user