-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSpinner.spec.ts
35 lines (30 loc) · 997 Bytes
/
Spinner.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import WidgetFactory from "../WidgetFactory";
import Spinner from "../Spinner";
import { it, expect, describe } from "vitest";
describe("A Spinner", () => {
it("should have an id corresponding to field name", () => {
const widgetFactory = new WidgetFactory();
const props = {
name: "spinner",
};
const widget = widgetFactory.createWidget("spinner", props);
expect(widget).toBeInstanceOf(Spinner);
});
it("should properly set label", () => {
const widgetFactory = new WidgetFactory();
const props = {
name: "spinner",
string: "spinner caption",
};
const widget = widgetFactory.createWidget("spinner", props);
expect(widget.label).toBe("spinner caption");
});
it("should have loading as false by default", () => {
const widgetFactory = new WidgetFactory();
const props = {
name: "spinner",
};
const widget = widgetFactory.createWidget("spinner", props);
expect(widget.loading).toBe(false);
});
});