forked from stackwiseai/stackwise
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhandleWeirdObject.test.ts
More file actions
50 lines (34 loc) · 1.61 KB
/
handleWeirdObject.test.ts
File metadata and controls
50 lines (34 loc) · 1.61 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
import handleWeirdObject from './handleWeirdObject';
import jsonifyString from './jsonify';
test('identifies and extracts placeholders from JSON-like string', () => {
// Sample JSON-like string with placeholders
const inputString = `{ x, y, "z": z }`;
const result = handleWeirdObject(inputString);
const expectedOutput = `{"x": x, "y": y, "z": z}`;
console.log(result);
// Check if the result matches the expected output
expect(result).toEqual(expectedOutput);
});
test('identifies and extracts placeholders from JSON-like string', () => {
// Sample JSON-like string with placeholders
const inputString = `{ x, y, "z": z }`;
const result = handleWeirdObject(inputString);
const expectedOutput = `{"x": x, "y": y, "z": z}`;
console.log(result);
// Check if the result matches the expected output
expect(result).toEqual(expectedOutput);
});
test('identifies and extracts placeholders from JSON-like string', () => {
// Sample JSON-like string with placeholders
const inputString = `{
"dictionary": {
"Use the chatCompletion endpoint from openai to return a response": "callOpenAI",
"Find a good name for this method.": "pickMethodName"
}}`;
const result = handleWeirdObject(inputString);
const expectedOutput = `{
"dictionary": {"Use the chatCompletion endpoint from openai to return a response": "callOpenAI", "Find a good name for this method.": "pickMethodName"}}`;
console.log(result);
// Check if the result matches the expected output
expect(result).toEqual(expectedOutput);
});