Skip to content

Commit

Permalink
Fix test accessors
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastian-aranda committed May 9, 2023
1 parent 822ee57 commit e8f92d2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion love/src/redux/selectors/selectors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ export const getLastestAlarms = (state) => {

export const getLastAlarm = (state) => {
if (state.ws === undefined) return undefined;
return getStreamData(state, 'event-Watcher-0-alarm');
return getStreamData(state, 'event-Watcher-0-alarm')[0];
};

export const getObservingLogs = (state) => {
Expand Down
8 changes: 4 additions & 4 deletions love/src/redux/tests/alarms.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,15 @@ describe('GIVEN we have no alarms in the state', () => {
csc: 'Watcher',
salindex: 0, // watcher salindex
data: {
alarm,
alarm: [alarm],
},
},
],
});

// Assert:
expectedAlarms.push(alarm);
const watcherAlarmStream = getStreamData(store.getState(), 'event-Watcher-0-alarm');
const watcherAlarmStream = getStreamData(store.getState(), 'event-Watcher-0-alarm')[0];
const lastAlarm = getLastAlarm(store.getState());
const allAlarms = getAllAlarms(store.getState());
expect(watcherAlarmStream).toEqual(alarm);
Expand Down Expand Up @@ -221,15 +221,15 @@ describe('GIVEN we have some alarms in the state', () => {
csc: 'Watcher',
salindex: 0, // watcher salindex
data: {
alarm: updatedAlarm,
alarm: [updatedAlarm],
},
},
],
});

// Assert:
const expectedAlarms = [alarms[0], updatedAlarm, alarms[2]];
const watcherAlarmStream = getStreamData(store.getState(), 'event-Watcher-0-alarm');
const watcherAlarmStream = getStreamData(store.getState(), 'event-Watcher-0-alarm')[0];
const lastAlarm = getLastAlarm(store.getState());
const allAlarms = getAllAlarms(store.getState());
expect(watcherAlarmStream).toEqual(updatedAlarm);
Expand Down

0 comments on commit e8f92d2

Please sign in to comment.