|
1 | 1 | import * as Plot from "@observablehq/plot"; |
2 | | -import assert from "assert"; |
3 | | -import it from "./jsdom.js"; |
| 2 | +import {assert, it} from "vitest"; |
4 | 3 |
|
5 | 4 | it("mark(data, {sort}) needs y1 and y2 when sorting by height", () => { |
6 | | - assert.throws(() => Plot.dot([], {sort: {x: "height"}}).plot(), /^Error: missing channel: y1$/); |
7 | | - assert.throws(() => Plot.dot([], {channels: {y1: "1"}, sort: {x: "height"}}).plot(), /^Error: missing channel: y2$/); |
| 5 | + assert.throws(() => Plot.dot([], {sort: {x: "height"}}).plot(), /missing channel: y1$/); |
| 6 | + assert.throws(() => Plot.dot([], {channels: {y1: "1"}, sort: {x: "height"}}).plot(), /missing channel: y2$/); |
8 | 7 | }); |
9 | 8 |
|
10 | 9 | it("mark(data, {sort}) needs x1 and x2 when sorting by width", () => { |
11 | | - assert.throws(() => Plot.dot([], {sort: {y: "width"}}).plot(), /^Error: missing channel: x1$/); |
12 | | - assert.throws(() => Plot.dot([], {channels: {x1: "1"}, sort: {y: "width"}}).plot(), /^Error: missing channel: x2$/); |
| 10 | + assert.throws(() => Plot.dot([], {sort: {y: "width"}}).plot(), /missing channel: x1$/); |
| 11 | + assert.throws(() => Plot.dot([], {channels: {x1: "1"}, sort: {y: "width"}}).plot(), /missing channel: x2$/); |
13 | 12 | }); |
14 | 13 |
|
15 | 14 | it("mark(data, {sort}) rejects an invalid order", () => { |
16 | | - assert.throws(() => Plot.dotY([0, 1], {sort: {y: {value: "x", order: "neo" as any}}}).plot(), /^Error: invalid order: neo$/); // prettier-ignore |
| 15 | + assert.throws(() => Plot.dotY([0, 1], {sort: {y: {value: "x", order: "neo" as any}}}).plot(), /invalid order: neo$/); // prettier-ignore |
17 | 16 | }); |
0 commit comments