-
-
Notifications
You must be signed in to change notification settings - Fork 133
/
GraphQLUpload.test.mjs
62 lines (55 loc) · 1.33 KB
/
GraphQLUpload.test.mjs
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// @ts-check
import { doesNotThrow, throws } from "node:assert";
import { describe, it } from "node:test";
import { parseValue } from "graphql";
import GraphQLUpload from "./GraphQLUpload.mjs";
import Upload from "./Upload.mjs";
describe(
"GraphQL scalar `GraphQLUpload`.",
{
concurrency: true,
},
() => {
it("Method `parseValue`, value valid.", () => {
doesNotThrow(() => {
GraphQLUpload.parseValue(new Upload());
});
});
it("Method `parseValue`, value invalid.", () => {
throws(
() => {
GraphQLUpload.parseValue(true);
},
{
name: "GraphQLError",
message: "Upload value invalid.",
},
);
});
it("Method `parseLiteral`.", () => {
throws(
() => {
// The dummy value is irrelevant.
GraphQLUpload.parseLiteral(parseValue('""'));
},
{
name: "GraphQLError",
message: "Upload literal unsupported.",
locations: [{ line: 1, column: 1 }],
},
);
});
it("Method `serialize`.", () => {
throws(
() => {
// The dummy value is irrelevant.
GraphQLUpload.serialize("");
},
{
name: "GraphQLError",
message: "Upload serialization unsupported.",
},
);
});
},
);