add more stats to mobile and fix refresh stint
This commit is contained in:
@@ -26,7 +26,8 @@ function waitForServer(child, timeoutMs = 10000) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let output = "";
|
||||
const timeout = setTimeout(() => {
|
||||
reject(new Error(`Server startup timed out. Output:\n${output}`));
|
||||
reject(new Error(`Server startup timed out. Output:
|
||||
${output}`));
|
||||
}, timeoutMs);
|
||||
const onData = (chunk) => {
|
||||
output += chunk.toString();
|
||||
@@ -42,7 +43,8 @@ function waitForServer(child, timeoutMs = 10000) {
|
||||
});
|
||||
child.once("exit", (code, signal) => {
|
||||
clearTimeout(timeout);
|
||||
reject(new Error(`Server exited before startup (code=${code}, signal=${signal}). Output:\n${output}`));
|
||||
reject(new Error(`Server exited before startup (code=${code}, signal=${signal}). Output:
|
||||
${output}`));
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -211,6 +213,28 @@ test("SQLite API persists state, passings, and overlay session results", { timeo
|
||||
const storedPayload = await storedResponse.json();
|
||||
assert.deepEqual(storedPayload.state, initialState);
|
||||
|
||||
const markerResponse = await fetch(baseUrl + "/public-training/api/" + shareToken + "/markers", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ classId: "class_1", type: "car", note: "Ride height change" }),
|
||||
});
|
||||
const markerPayload = await markerResponse.json();
|
||||
assert.equal(markerResponse.status, 201);
|
||||
assert.equal(markerPayload.marker.type, "car");
|
||||
const markerStateResponse = await fetch(baseUrl + "/api/state");
|
||||
const markerState = await markerStateResponse.json();
|
||||
assert.equal(markerState.state.training.markers.length, 1);
|
||||
assert.equal(markerState.state.training.markers[0].driverId, "driver_1");
|
||||
assert.equal(markerState.state.training.markers[0].classId, "class_1");
|
||||
assert.equal(markerState.state.training.markers[0].note, "Ride height change");
|
||||
|
||||
const invalidMarkerResponse = await fetch(baseUrl + "/public-training/api/" + shareToken + "/markers", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ classId: "unknown_class", type: "car" }),
|
||||
});
|
||||
assert.equal(invalidMarkerResponse.status, 404);
|
||||
|
||||
const sessionResult = {
|
||||
competitors: {
|
||||
driver_1: { key: "driver_1", driverName: "Driver One", laps: 1, bestLapMs: 16500 },
|
||||
|
||||
Reference in New Issue
Block a user