Merge pull request #864 from porink0424/fix/delete-ts-tests

Delete `optuna_dashboard/ts/tests/`
This commit is contained in:
c-bata
2024-04-17 15:12:34 +09:00
committed by GitHub
6 changed files with 1 additions and 4998 deletions
-18
View File
@@ -45,24 +45,6 @@ jobs:
npm run build:dev
npm run build:prd
test:
name: Run tests
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@master
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '20'
- name: Run jest
working-directory: optuna_dashboard
run: |
npm install
npm run test
test-tslib:
name: Run tests
runs-on: ubuntu-latest
-11
View File
@@ -1,11 +0,0 @@
module.exports = {
preset: 'ts-jest',
testEnvironment: 'jsdom',
setupFiles: ["jest-canvas-mock"],
globals: {
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV),
'APP_BAR_TITLE': JSON.stringify(process.env.APP_BAR_TITLE || "Optuna Dashboard"),
'API_ENDPOINT': JSON.stringify(process.env.API_ENDPOINT || ""),
'URL_PREFIX': JSON.stringify(process.env.URL_PREFIX || "/dashboard")
}
};
-4887
View File
File diff suppressed because it is too large Load Diff
+1 -8
View File
@@ -8,8 +8,7 @@
"watch": "NODE_ENV=development TYPESCRIPT_LOADER=esbuild-loader webpack --watch",
"build": "webpack",
"build:dev": "NODE_ENV=development TYPESCRIPT_LOADER=esbuild-loader webpack",
"build:prd": "NODE_ENV=production webpack",
"test": "jest ts/tests"
"build:prd": "NODE_ENV=production webpack"
},
"author": "Masashi Shibata",
"license": "MIT",
@@ -46,8 +45,6 @@
"devDependencies": {
"@babel/core": "^7.23.9",
"@babel/preset-env": "^7.23.9",
"@testing-library/react": "^14.1.2",
"@types/jest": "^29.5.11",
"@types/plotly.js": "^2.12.32",
"@types/react": "^18.2.48",
"@types/react-dom": "^18.2.18",
@@ -55,11 +52,7 @@
"compression-webpack-plugin": "^11.0.0",
"css-loader": "^6.9.1",
"esbuild-loader": "^4.0.3",
"jest": "^29.7.0",
"jest-canvas-mock": "^2.5.2",
"jest-environment-jsdom": "^29.7.0",
"style-loader": "^3.3.4",
"ts-jest": "^29.1.2",
"ts-loader": "^9.5.1",
"typescript": "^5.3.3",
"webpack": "^5.90.0",
@@ -1,40 +0,0 @@
import React from "react"
global.URL.createObjectURL = jest.fn()
import { cleanup, render } from "@testing-library/react"
import { DataGrid, DataGridColumn } from "../components/DataGrid"
afterEach(cleanup)
// TODO(c-bata): Add tests to check filterChoices option
it("Filter rows of DataGrid", () => {
interface DummyAttribute {
id: number
key: string
value: number
}
const dummyAttributes = [
{ id: 1, key: "foo", value: 1 },
{ id: 2, key: "bar", value: 1 },
{ id: 3, key: "bar", value: 2 },
{ id: 4, key: "foo", value: 2 },
{ id: 5, key: "foo", value: 3 },
]
const columns: DataGridColumn<DummyAttribute>[] = [
{ field: "key", label: "Key" },
{
field: "value",
label: "Value",
sortable: true,
},
]
const { queryAllByText } = render(
<DataGrid<DummyAttribute>
columns={columns}
rows={dummyAttributes}
keyField={"id"}
/>
)
expect(queryAllByText("bar").length).toBe(2)
})
@@ -1,34 +0,0 @@
import { mergeUnionSearchSpace } from "../searchSpace"
global.URL.createObjectURL = jest.fn()
it("Aggregate SearchSpaceItem", () => {
const aggregated = mergeUnionSearchSpace([
{
name: "float1",
distribution: {
type: "FloatDistribution",
low: 0,
high: 5,
step: 1,
log: true,
},
},
{
name: "float1",
distribution: {
type: "FloatDistribution",
low: 5,
high: 10,
step: 1,
log: true,
},
},
])
expect(aggregated.length).toBe(1)
// @ts-ignore
expect(aggregated[0].distribution.low as number).toBe(0)
// @ts-ignore
expect(aggregated[0].distribution.high as number).toBe(10)
})