Skip to content

Commit

Permalink
Broken tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mrozbarry committed Apr 5, 2024
1 parent 3cfc0c8 commit e752d63
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 92 deletions.
30 changes: 1 addition & 29 deletions public/actions.goal.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down Expand Up @@ -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,
},
},
}),
);
});
51 changes: 43 additions & 8 deletions public/actions.init.test.js.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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',
Expand Down Expand Up @@ -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,
Expand All @@ -131,6 +165,7 @@ Generated by [AVA](https://avajs.dev).
[
Function CheckSettingsFX {},
{
onAllowSound: Function SetAllowSound {},
onDarkEnabled: Function SetDark {},
onLocalSoundEnabled: Function SoundToast {},
storage: undefined,
Expand Down
Binary file modified public/actions.init.test.js.snap
Binary file not shown.
2 changes: 1 addition & 1 deletion public/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
17 changes: 0 additions & 17 deletions public/actions.misc.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down Expand Up @@ -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,
});
});
28 changes: 0 additions & 28 deletions public/actions.mob-rename.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: '' };

Expand Down
5 changes: 4 additions & 1 deletion public/actions.mob.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
File renamed without changes.
20 changes: 12 additions & 8 deletions public/actions.timer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}),
);
});
Expand Down Expand Up @@ -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,
}),
);
});
Expand Down Expand Up @@ -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,
}),
);
});
1 change: 1 addition & 0 deletions src/web/actions.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit e752d63

Please sign in to comment.