feat: v0.9.2 — power-of-two time scale: slider steps through the 1/2/4/8/16/32/64 ladder, POST /api/sim clamp widened to [1,64]
This commit is contained in:
+4
-4
@@ -54,7 +54,7 @@ test('left pane renders wallet, reputation and the starter fleet at Frankfurt',
|
||||
await expect(page.getByTestId('sim-clock')).toContainText(/UTC/);
|
||||
});
|
||||
|
||||
test('time controls: pause freezes the sim and the log-scale slider sets timeScale', async ({ page }) => {
|
||||
test('time controls: pause freezes the sim and the power-of-two slider sets timeScale', async ({ page }) => {
|
||||
await page.goto('/');
|
||||
const pauseBtn = page.getByTestId('pause-toggle');
|
||||
await expect(pauseBtn).toBeVisible({ timeout: 15_000 });
|
||||
@@ -65,13 +65,13 @@ test('time controls: pause freezes the sim and the log-scale slider sets timeSca
|
||||
// …and in the pane itself (the refetch after POST flips the button to Resume).
|
||||
await expect(pauseBtn).toHaveText('Resume');
|
||||
|
||||
// Scale via the log-scale slider. End jumps to max (t=1 → 60×): the label updates
|
||||
// Scale via the power-of-two slider. End jumps to max (t=1 → 64×): the label updates
|
||||
// optimistically on input, and release flushes the debounced POST immediately.
|
||||
const slider = page.getByTestId('time-scale-slider');
|
||||
await slider.focus();
|
||||
await page.keyboard.press('End');
|
||||
await expect(page.getByTestId('time-scale-value')).toHaveText('60×', { timeout: 10_000 });
|
||||
await expect.poll(async () => (await getState(page)).simState.timeScale, { timeout: 10_000 }).toBe(60);
|
||||
await expect(page.getByTestId('time-scale-value')).toHaveText('64×', { timeout: 10_000 });
|
||||
await expect.poll(async () => (await getState(page)).simState.timeScale, { timeout: 10_000 }).toBe(64);
|
||||
|
||||
// Home jumps to min (t=0 → 1×).
|
||||
await page.keyboard.press('Home');
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ test('the hook can also create a fresh short-deadline contract, which then expir
|
||||
test('POST /api/sim validates and clamps its input', async ({ page }) => {
|
||||
const clampHigh = await postSim(page, { timeScale: 500 });
|
||||
expect(clampHigh.status()).toBe(200);
|
||||
expect(((await clampHigh.json()) as SimState).timeScale).toBe(60);
|
||||
expect(((await clampHigh.json()) as SimState).timeScale).toBe(64); // top of the power-of-two ladder (v0.9.2)
|
||||
|
||||
const clampLow = await postSim(page, { timeScale: 0.1 });
|
||||
expect(clampLow.status()).toBe(200);
|
||||
|
||||
Reference in New Issue
Block a user