-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into fix-show-only-changed
- Loading branch information
Showing
34 changed files
with
1,979 additions
and
909 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { getValue } from './util' | ||
import rowsFixture from '../../test/fixtures/expShow/base/rows' | ||
import columnsFixture from '../../test/fixtures/expShow/base/columns' | ||
import { ColumnType } from '../webview/contract' | ||
|
||
describe('getValue', () => { | ||
const experiment = rowsFixture[0] | ||
|
||
const getPathArrayFromType = (columnType: ColumnType) => { | ||
const column = columnsFixture.find( | ||
({ type, hasChildren }) => type === columnType && !hasChildren | ||
) | ||
|
||
if (!column) { | ||
throw new Error('column not defined') | ||
} | ||
const { pathArray } = column | ||
expect(pathArray).toBeDefined() | ||
if (!pathArray) { | ||
throw new Error('pathArray not defined') | ||
} | ||
return pathArray | ||
} | ||
|
||
it('should return the expected value for an experiment given a metric', () => { | ||
const pathArray = getPathArrayFromType(ColumnType.METRICS) | ||
expect(getValue(experiment, pathArray)).toStrictEqual(1.775016188621521) | ||
}) | ||
|
||
it('should return the expected value for an experiment given a param', () => { | ||
const pathArray = getPathArrayFromType(ColumnType.PARAMS) | ||
expect(getValue(experiment, pathArray)).toStrictEqual([0, 1]) | ||
}) | ||
|
||
it('should return the expected value for an experiment given a dep', () => { | ||
const pathArray = getPathArrayFromType(ColumnType.DEPS) | ||
expect(getValue(experiment, pathArray)).toStrictEqual('22a1a29') | ||
}) | ||
|
||
it('should not mutate the original array', () => { | ||
const pathArray = getPathArrayFromType(ColumnType.DEPS) | ||
const copy = [...pathArray] | ||
getValue(experiment, pathArray) | ||
expect(pathArray).toStrictEqual(copy) | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.