UNPKG

950 BJavaScriptView Raw
1const { defaultPlan, preLoadJq, preToUtf8 } = require("../build/index");
2const { DefaultPlan } = require("../build/defaultPlan");
3
4test("function defaultPlan parameter check", () => {
5 expect(() => {
6 defaultPlan("string");
7 }).toThrow(TypeError);
8 expect(() => {
9 defaultPlan(100);
10 }).toThrow(TypeError);
11 expect(() => {
12 defaultPlan(true);
13 }).toThrow(TypeError);
14
15 expect(() => {
16 defaultPlan({
17 callbacks: [
18 () => "this is a function",
19 ],
20 name: "plan1",
21 });
22 }).not.toThrow(TypeError);
23
24 expect(() => {
25 defaultPlan({});
26 }).toThrow(TypeError);
27 expect(() => {
28 defaultPlan({info: "a object without callback"});
29 }).toThrow(TypeError);
30
31 expect(() => {
32 defaultPlan({name: "plan1", callbacks: [() => "a object with callback"]});
33 }).not.toThrow(TypeError);
34});