Skip to content

Commit

Permalink
chore: fix github workflow and failing tests (#16593)
Browse files Browse the repository at this point in the history
Messed up the app test workflow so it wasn't running and therefore we
didn't notice some tests were failing. Fix the workflow, fix the tests.

Only changes of note are that vitest doesn't support baseline 2023
copying array reorder functions for some reason so replace them with
equivalents.
  • Loading branch information
sfoster1 authored Oct 24, 2024
1 parent 9d57048 commit 02236b3
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/app-test-build-deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ jobs:
yarn config set cache-folder ${{ github.workspace }}/.yarn-cache
make setup-js
- name: 'test native(er) packages'
run: make test-js-internal tests="${{}matrix.shell}/src" cov_opts="--coverage=true"
run: make test-js-internal tests="${{matrix.shell}}/src" cov_opts="--coverage=true"
- name: 'Upload coverage report'
uses: 'codecov/codecov-action@v3'
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,13 @@ export function useHistoricRunDetails(
hostOverride?: HostConfig | null
): RunData[] {
const { data: allHistoricRuns } = useNotifyAllRunsQuery({}, {}, hostOverride)

return allHistoricRuns == null
? []
: allHistoricRuns.data.toSorted(
(a, b) =>
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
)
: // TODO(sf): figure out why .toSorted() doesn't work in vitest
allHistoricRuns.data
.map(t => t)
.sort(
(a, b) =>
new Date(b.createdAt).getTime() - new Date(a.createdAt).getTime()
)
}
3 changes: 1 addition & 2 deletions app/src/pages/ODD/RobotDashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,7 @@ export function RobotDashboard(): JSX.Element {
)

const recentRunsOfUniqueProtocols = (allRunsQueryData?.data ?? [])
.toReversed() // newest runs first
.reduce<RunData[]>((acc, run) => {
.reduceRight<RunData[]>((acc, run) => {
if (
acc.some(collectedRun => collectedRun.protocolId === run.protocolId)
) {
Expand Down
2 changes: 2 additions & 0 deletions app/src/redux/config/__tests__/config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,15 @@ describe('config', () => {
expect(Cfg.configInitialized(state.config as any)).toEqual({
type: 'config:INITIALIZED',
payload: { config: state.config },
meta: { shell: true },
})
})

it('can create an config:VALUE_UPDATED action for a successful update', () => {
expect(Cfg.configValueUpdated('foo.bar', false)).toEqual({
type: 'config:VALUE_UPDATED',
payload: { path: 'foo.bar', value: false },
meta: { shell: true },
})
})

Expand Down

0 comments on commit 02236b3

Please sign in to comment.