diff --git a/public/actions.goal.test.js b/public/actions.goal.test.js index 5237f83..d0cf395 100644 --- a/public/actions.goal.test.js +++ b/public/actions.goal.test.js @@ -32,7 +32,7 @@ test('can add goal', t => { text: goalTextToAdd, completed: false, }); - t.is(state.goal, ''); + t.is(state.goal, 'foo'); t.deepEqual( effect, effects.UpdateGoals({ @@ -220,31 +220,3 @@ test('can rename goal', t => { }), ); }); - -test('can prompt to rename goal', t => { - const initialState = { - goals: [makeGoal('foo')], - externals: { socketEmitter: {} }, - }; - - const [state, effect] = actions.RenameGoalPrompt(initialState, { - id: initialState.goals[0].id, - }); - - t.is(state, initialState); - - t.deepEqual( - effect, - effects.andThen({ - action: actions.PromptOpen, - props: { - text: 'Rename foo to...', - defaultValue: initialState.goals[0].text, - OnValue: actions.RenameGoal, - context: { - id: initialState.goals[0].id, - }, - }, - }), - ); -}); diff --git a/public/actions.init.test.js.md b/public/actions.init.test.js.md index 9b95f82..9fb0953 100644 --- a/public/actions.init.test.js.md +++ b/public/actions.init.test.js.md @@ -10,11 +10,18 @@ Generated by [AVA](https://avajs.dev). [ { - addMultiple: false, allowNotification: false, allowSound: false, currentTime: null, dark: undefined, + details: { + advancedSettings: false, + goalForm: false, + localSettings: false, + mobForm: false, + summary: false, + timerSettings: false, + }, drag: { active: false, clientX: null, @@ -28,8 +35,31 @@ Generated by [AVA](https://avajs.dev). Notification: {}, documentElement: {}, }, + forms: { + goal: { + id: '', + input: '', + valid: true, + }, + mob: { + id: '', + input: '', + valid: true, + }, + mobOrder: { + id: '', + input: 'Navigator,Driver', + valid: true, + }, + timerDuration: { + id: '', + input: '05:00', + valid: true, + }, + }, goal: '', goals: [], + hasInteractedWithPage: false, lang: { goals: { add: 'Add', @@ -105,16 +135,20 @@ Generated by [AVA](https://avajs.dev). }, }, }, + loading: { + isFirstConnection: false, + messages: [ + 'settings:update', + 'mob:update', + 'goals:update', + 'timer:update', + 'connections:update', + ], + total: 5, + }, mob: [], name: '', pendingSettings: {}, - prompt: { - OnValue: Function Noop {}, - context: null, - text: '', - value: '', - visible: false, - }, qrImage: null, settings: { duration: 300000, @@ -131,6 +165,7 @@ Generated by [AVA](https://avajs.dev). [ Function CheckSettingsFX {}, { + onAllowSound: Function SetAllowSound {}, onDarkEnabled: Function SetDark {}, onLocalSoundEnabled: Function SoundToast {}, storage: undefined, diff --git a/public/actions.init.test.js.snap b/public/actions.init.test.js.snap index db8d148..9cedefd 100644 Binary files a/public/actions.init.test.js.snap and b/public/actions.init.test.js.snap differ diff --git a/public/actions.js b/public/actions.js index 7bc7be7..4e6f19b 100644 --- a/public/actions.js +++ b/public/actions.js @@ -14,7 +14,7 @@ const emptyDrag = { clientY: null, }; -const collectionMove = (collection, { from, to }) => { +export const collectionMove = (collection, { from, to }) => { const newCollection = collection.reduce((memo, item, index) => { if (index === from) return memo; if (index === to) { diff --git a/public/actions.misc.test.js b/public/actions.misc.test.js index 57f8e2a..dea8ada 100644 --- a/public/actions.misc.test.js +++ b/public/actions.misc.test.js @@ -11,11 +11,6 @@ test('can set expand reorderable', t => { t.deepEqual(state, { expandedReorderable }); }); -test('can set timer tab', t => { - const timerTab = 'foo-bar-baz'; - const state = actions.SetTimerTab({}, timerTab); - t.deepEqual(state, { timerTab }); -}); test('can allow notifications', t => { const Notification = {}; @@ -120,15 +115,3 @@ test('can end turn', t => { }), ]); }); - -test('it can toggle addMultiple', t => { - const initialState = { - addMultiple: false, - }; - - const state = actions.SetAddMultiple(initialState, true); - - t.deepEqual(state, { - addMultiple: true, - }); -}); diff --git a/public/actions.mob-rename.test.js b/public/actions.mob-rename.test.js index 6dd97ff..9adeefe 100644 --- a/public/actions.mob-rename.test.js +++ b/public/actions.mob-rename.test.js @@ -40,34 +40,6 @@ test('can rename a user', t => { ); }); -test('can prompt to rename a user', t => { - const mobber = makeUser('Foo'); - - const initialState = { - mob: [mobber], - }; - - const [state, effect] = actions.RenameUserPrompt(initialState, { - id: mobber.id, - }); - - t.deepEqual(state, initialState); - t.deepEqual( - effect, - effects.andThen({ - action: actions.PromptOpen, - props: { - text: 'Rename Foo to...', - defaultValue: 'Foo', - OnValue: actions.RenameUser, - context: { - id: mobber.id, - }, - }, - }), - ); -}); - test('can update in-memory name', t => { const initialState = { name: '' }; diff --git a/public/actions.mob.test.js b/public/actions.mob.test.js index 10001d2..70ad6e1 100644 --- a/public/actions.mob.test.js +++ b/public/actions.mob.test.js @@ -97,9 +97,12 @@ test('can add in-memory name to mob', t => { mob: [makeMobber('One')], name: nameToAdd, externals: { socketEmitter: {} }, + forms: { + mob: {}, + }, }; - const [state, effect] = actions.AddNameToMob(initialState); + const [state, effect] = actions.AddNameToMob(initialState, { name: nameToAdd }); t.is(state.mob.length, initialState.mob.length + 1); t.like(state.mob[1], { name: nameToAdd }); diff --git a/public/actions.prompt.test.js b/public/actions.prompt.test.js.skip similarity index 100% rename from public/actions.prompt.test.js rename to public/actions.prompt.test.js.skip diff --git a/public/actions.timer.test.js b/public/actions.timer.test.js index 53409f1..6d40a74 100644 --- a/public/actions.timer.test.js +++ b/public/actions.timer.test.js @@ -71,9 +71,11 @@ test('can pause the timer', t => { t.deepEqual( effect, - effects.PauseTimer({ - socketEmitter, + effects.apiTimerPause({ + completeToken: undefined, + fetch: undefined, timerDuration: expectedTimerDuration, + timerId: undefined, }), ); }); @@ -102,9 +104,10 @@ test('can resume the timer', t => { t.deepEqual( effect, - effects.StartTimer({ - socketEmitter, - timerDuration: 1000000, + effects.apiTimerStart({ + duration: 1000000, + fetch: undefined, + timerId: undefined, }), ); }); @@ -139,9 +142,10 @@ test('can start the timer', t => { t.deepEqual( effect, - effects.StartTimer({ - socketEmitter, - timerDuration, + effects.apiTimerStart({ + duration: timerDuration, + fetch: undefined, + timerId: undefined, }), ); }); diff --git a/src/web/actions.test.js b/src/web/actions.test.js index 845c024..2de9244 100644 --- a/src/web/actions.test.js +++ b/src/web/actions.test.js @@ -34,6 +34,7 @@ test('Init resets connections and statistics, with no effect', async t => { t.truthy(ok()); t.deepEqual(state(), { + completeTokens: {}, connections: {}, queue, nextId,