-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathindex.test-d.ts
73 lines (68 loc) · 1.9 KB
/
index.test-d.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
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
63
64
65
66
67
68
69
70
71
72
73
import { expectType, expectError } from 'tsd';
import { Category, Description, Essay, GIFTQuestion, Matching, MultipleChoice, Numerical, parse, ShortAnswer, SyntaxError, TrueFalse } from ".";
expectType<GIFTQuestion[]>(parse('Text'));
const questions = parse("Text");
for (const question of questions) {
switch (question.type) {
case "Category":
expectType<Category>(question);
break;
case "Description":
expectType<Description>(question);
break;
case "MC":
expectType<MultipleChoice>(question);
break;
case "Numerical":
expectType<Numerical>(question);
break;
case "Short":
expectType<ShortAnswer>(question);
break;
case "Essay":
expectType<Essay>(question);
break;
case "TF":
expectType<TrueFalse>(question);
break;
case "Matching":
expectType<Matching>(question);
break;
default:
break;
}
}
const multipleChoiceObject: MultipleChoice = {
id: null,
tags: null,
type: "MC",
title: null,
stem: { format: "markdown", text: "Who's buried in Grant's \r\n tomb?" },
hasEmbeddedAnswers: false,
globalFeedback: {
format: "moodle",
text:
"Not sure?."
},
choices: [
{
isCorrect: false,
weight: -50,
text: { format: "moodle", text: "Grant" },
feedback: null
},
{
isCorrect: true,
weight: 50,
text: { format: "moodle", text: "Jefferson" },
feedback: null
},
{
isCorrect: true,
weight: 50,
text: { format: "moodle", text: "no one" },
feedback: null
}
]
};
expectType<MultipleChoice>(multipleChoiceObject)