-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathtest-code-blocks.json
More file actions
59 lines (59 loc) · 1.92 KB
/
Copy pathtest-code-blocks.json
File metadata and controls
59 lines (59 loc) · 1.92 KB
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
{
"title": "Code Block Test",
"description": "Testing code block rendering in questions and options",
"questions": [
{
"id": "q1",
"type": "single",
"question": "Question with code block above options",
"context": "Review the current implementation:",
"content": {
"source": "function calculateTotal(items) {\n let total = 0;\n for (const item of items) {\n total += item.price * item.quantity;\n }\n return total;\n}",
"lang": "ts",
"file": "src/cart.ts",
"lines": "10-16",
"highlights": [3, 4]
},
"options": ["Keep it", "Refactor it", "Delete it"]
},
{
"id": "q2",
"type": "single",
"question": "Which implementation approach?",
"options": [
{
"label": "Use reduce",
"content": {
"source": "const total = items.reduce(\n (sum, item) => sum + item.price * item.quantity,\n 0\n);",
"lang": "ts"
}
},
{
"label": "Use for...of loop",
"content": {
"source": "let total = 0;\nfor (const item of items) {\n total += item.price * item.quantity;\n}",
"lang": "ts"
}
},
"Keep current implementation"
],
"recommended": "Use reduce"
},
{
"id": "q3",
"type": "single",
"question": "Review this diff - should we merge?",
"content": {
"source": "--- a/src/cart.ts\n+++ b/src/cart.ts\n@@ -10,6 +10,8 @@\n function calculateTotal(items) {\n let total = 0;\n for (const item of items) {\n+ if (item.quantity < 0) continue;\n total += item.price * item.quantity;\n }\n return total;\n }",
"lang": "diff",
"file": "src/cart.ts"
},
"options": ["Approve", "Request changes", "Need more context"]
},
{
"id": "q4",
"type": "text",
"question": "Any comments on the code?"
}
]
}