Skip to content

Commit

Permalink
Refactor more helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
wolmir committed Jul 12, 2022
1 parent 060dac2 commit 614ff4a
Showing 1 changed file with 8 additions and 18 deletions.
26 changes: 8 additions & 18 deletions webview/src/test/tableDataFixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,23 +41,13 @@ export const transformRows = (
} as TableData
}

export const setExperimentsAsStarred = (
fixture: TableData,
labelOrIds: string[]
) => {
return transformRows(fixture, labelOrIds, row => ({ ...row, starred: true }))
}
export const setRowPropertyAsTrue =
(prop: keyof Row) => (fixture: TableData, labelOrIds: string[]) => {
return transformRows(fixture, labelOrIds, row => ({ ...row, [prop]: true }))
}

export const setExperimentsAsSelected = (
fixture: TableData,
labelOrIds: string[]
) => {
return transformRows(fixture, labelOrIds, row => ({ ...row, selected: true }))
}
export const setExperimentsAsStarred = setRowPropertyAsTrue('starred')

export const setExperimentsAsRunning = (
fixture: TableData,
labelOrIds: string[]
) => {
return transformRows(fixture, labelOrIds, row => ({ ...row, running: true }))
}
export const setExperimentsAsSelected = setRowPropertyAsTrue('selected')

export const setExperimentsAsRunning = setRowPropertyAsTrue('running')

0 comments on commit 614ff4a

Please sign in to comment.