-
Notifications
You must be signed in to change notification settings - Fork 219
Expand file tree
/
Copy pathmark-test.ts
More file actions
16 lines (13 loc) · 838 Bytes
/
mark-test.ts
File metadata and controls
16 lines (13 loc) · 838 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
import * as Plot from "@observablehq/plot";
import {assert, it} from "vitest";
it("mark(data, {sort}) needs y1 and y2 when sorting by height", () => {
assert.throws(() => Plot.dot([], {sort: {x: "height"}}).plot(), /missing channel: y1$/);
assert.throws(() => Plot.dot([], {channels: {y1: "1"}, sort: {x: "height"}}).plot(), /missing channel: y2$/);
});
it("mark(data, {sort}) needs x1 and x2 when sorting by width", () => {
assert.throws(() => Plot.dot([], {sort: {y: "width"}}).plot(), /missing channel: x1$/);
assert.throws(() => Plot.dot([], {channels: {x1: "1"}, sort: {y: "width"}}).plot(), /missing channel: x2$/);
});
it("mark(data, {sort}) rejects an invalid order", () => {
assert.throws(() => Plot.dotY([0, 1], {sort: {y: {value: "x", order: "neo" as any}}}).plot(), /invalid order: neo$/); // prettier-ignore
});