Skip to content

Commit 088048c

Browse files
tests okay
1 parent df6a439 commit 088048c

File tree

7 files changed

+22
-23
lines changed

7 files changed

+22
-23
lines changed

composables/api_fetch.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ export function api_fetch(
1212
const { valid, error } = validate_schema(schema, body)
1313

1414
if (!valid) {
15-
if (
16-
process.env.NODE_ENV === "development" ||
17-
process.env.NODE_ENV === "test"
18-
) {
15+
if (process.env.NODE_ENV !== "production") {
1916
console.log("Bad request", error, schema, params)
2017
}
2118
feedback_store.add_error(400, schema.$id, "Bad request", error)

composables/viewer_call.js

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,7 @@ export function viewer_call(
88
const { valid, error } = validate_schema(schema, params)
99

1010
if (!valid) {
11-
if (
12-
process.env.NODE_ENV === "development" ||
13-
process.env.NODE_ENV === "test"
14-
) {
11+
if (process.env.NODE_ENV !== "production") {
1512
console.log("Bad request", error, schema, params)
1613
}
1714
feedback_store.add_error(400, schema.$id, "Bad request", error)

internal_stores/mesh/polyhedra.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export function useMeshPolyhedraStyle() {
3333
const coloring = meshPolyhedraStyle(id).coloring
3434
coloring.active = type
3535
console.log(
36-
`${setMeshPolyhedraActiveColoring.name} ${meshPolyhedraActiveColoring(id)}`,
36+
`${setMeshPolyhedraActiveColoring.name} ${id} ${meshPolyhedraActiveColoring(id)}`,
3737
)
3838
if (type === "color") {
3939
return setMeshPolyhedraColor(id, coloring.color)
@@ -54,7 +54,9 @@ export function useMeshPolyhedraStyle() {
5454
{
5555
response_function: () => {
5656
coloring.color = color
57-
console.log(`${setMeshPolyhedraColor.name} ${meshPolyhedraColor(id)}`)
57+
console.log(
58+
`${setMeshPolyhedraColor.name} ${id} ${meshPolyhedraColor(id)}`,
59+
)
5860
},
5961
},
6062
)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"test": "npm run test:unit",
66
"tests": "vitest --config ./tests/vitest.config.js",
77
"test:unit": "npm run tests --project unit",
8-
"test:integration": "npm run tests --project integration --fileParallelism=false",
8+
"test:integration": "npm run tests --project integration",
99
"geode_objects": "node scripts/generate_geode_objects.js && prettier ./assets/geode_objects.js --write",
1010
"build": ""
1111
},

stores/data_style.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,18 @@ export const useDataStyleStore = defineStore("dataStyle", () => {
1010
const dataBaseStore = useDataBaseStore()
1111

1212
/** Actions **/
13-
async function addDataStyle(id, geode_object, object_type) {
13+
function addDataStyle(id, geode_object, object_type) {
1414
dataStyleState.styles[id] = getDefaultStyle(geode_object)
15+
const promise_array = []
1516
if (object_type === "mesh") {
16-
return meshStyleStore.applyMeshDefaultStyle(id)
17+
promise_array.push(meshStyleStore.applyMeshDefaultStyle(id))
1718
} else if (object_type === "model") {
18-
return [
19-
modelStyleStore.setMeshComponentsDefaultStyle(id),
20-
modelStyleStore.applyModelDefaultStyle(id),
21-
]
19+
promise_array.push(modelStyleStore.setMeshComponentsDefaultStyle(id))
20+
promise_array.push(modelStyleStore.applyModelDefaultStyle(id))
2221
} else {
2322
throw new Error("Unknown object type")
2423
}
24+
return Promise.all(promise_array)
2525
}
2626

2727
function setVisibility(id, visibility) {

tests/integration/setup.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -96,18 +96,21 @@ vi.stubGlobal("navigator", {
9696
},
9797
})
9898

99-
const data_folder_path = path.join(__dirname, "..", "..", "..", "data")
100-
10199
let foldersBeforeTests = new Set()
100+
101+
const data_folder = path.join("tests", "integration", "data")
102102
beforeAll(() => {
103103
global.WebSocket = WebSocket
104-
foldersBeforeTests = getCurrentFolders(data_folder_path)
104+
foldersBeforeTests = getCurrentFolders(data_folder)
105105
console.log("foldersBeforeTests", foldersBeforeTests)
106106
})
107107

108108
afterAll(() => {
109+
console.log("afterAll")
109110
delete global.WebSocket
110-
cleanupCreatedFolders(data_folder_path, foldersBeforeTests)
111+
setTimeout(() => {
112+
cleanupCreatedFolders(data_folder, foldersBeforeTests)
113+
}, 2000)
111114
})
112115

113116
export { setupIntegrationTests }

tests/integration/utils.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
import fs from "fs"
33
import path from "path"
44

5-
let foldersBeforeTests = new Set()
6-
75
function getCurrentFolders(dataFolderPath) {
86
if (!fs.existsSync(dataFolderPath)) {
97
return new Set()
@@ -24,10 +22,12 @@ function cleanupCreatedFolders(dataFolderPath, foldersBeforeTests) {
2422
return
2523
}
2624
const currentFolders = getCurrentFolders(dataFolderPath)
25+
console.log("getCurrentFolders currentFolders", currentFolders)
2726
for (const folder of currentFolders) {
2827
if (!foldersBeforeTests.has(folder)) {
2928
const folderPath = path.join(dataFolderPath, folder)
3029
fs.rmSync(folderPath, { recursive: true, force: true })
30+
console.log(`Deleted folder: ${folderPath}`)
3131
}
3232
}
3333
}

0 commit comments

Comments
 (0)