Skip to content

Commit 55d3908

Browse files
committed
simplify tests
1 parent 8523158 commit 55d3908

File tree

2 files changed

+55
-57
lines changed

2 files changed

+55
-57
lines changed

src/stack/buildStack/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export default async function buildStack({
3535
const brief = extractBrief(stackSnippet);
3636
console.log('brief after extraction');
3737
console.log(brief);
38-
console.log('stackSnippet before JSONFY');
38+
3939
const { input: inputString, outExample } = jsonify(stackSnippet);
4040
console.log('input after JSONIFY');
4141
console.log(inputString);

src/stack/jsonify/jsonify.test.ts

Lines changed: 54 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,71 @@
11
import transformJSON from './jsonify';
22

3-
describe('extractJSONPlaceholders', () => {
4-
test('identifies and extracts placeholders from JSON-like string', () => {
5-
// Sample JSON-like string with placeholders
3+
test('identifies and extracts placeholders from JSON-like string', () => {
4+
// Sample JSON-like string with placeholders
65

7-
const inputString = `stack (
8-
"ok this is an example",
9-
{
10-
"input": {
11-
"dictionary": {
12-
"Use the chatCompletion endpoint from openai to return a response": "callOpenAI",
13-
"Find a good name for this method.": "pickMethodName"
14-
},
15-
"textCode": isolatedFunction
6+
const inputString = `stack (
7+
"ok this is an example",
8+
{
9+
"input": {
10+
"dictionary": {
11+
"Use the chatCompletion endpoint from openai to return a response": "callOpenAI",
12+
"Find a good name for this method.": "pickMethodName"
1613
},
17-
"outExample": {
18-
"methodName": "callOpenAI"
19-
}
20-
})`;
14+
"textCode": isolatedFunction
15+
},
16+
"outExample": {
17+
"methodName": "callOpenAI"
18+
}
19+
})`;
2120

22-
const result = transformJSON(inputString);
21+
const result = transformJSON(inputString);
2322

24-
const expectedOutput = {
25-
input:
26-
'{"dictionary":{"Use the chatCompletion endpoint from openai to return a response":"callOpenAI","Find a good name for this method.":"pickMethodName"},"textCode":isolatedFunction}',
27-
outExample: {
28-
methodName: 'callOpenAI',
29-
},
30-
};
23+
const expectedOutput = {
24+
input:
25+
'{"dictionary":{"Use the chatCompletion endpoint from openai to return a response":"callOpenAI","Find a good name for this method.":"pickMethodName"},"textCode":isolatedFunction}',
26+
outExample: {
27+
methodName: 'callOpenAI',
28+
},
29+
};
3130

32-
// Check if the result matches the expected output
33-
expect(result).toEqual(expectedOutput);
34-
});
31+
// Check if the result matches the expected output
32+
expect(result).toEqual(expectedOutput);
33+
});
3534

36-
test('extract', () => {
37-
// Sample JSON-like string with placeholders
35+
test('extract', () => {
36+
// Sample JSON-like string with placeholders
3837

39-
const inputString = `stack("test", {
40-
input: { test: "ok" },
41-
outExample: { test: "ok" }
42-
})`;
38+
const inputString = `stack("test", {
39+
input: { test: "ok" },
40+
outExample: { test: "ok" }
41+
})`;
4342

44-
const result = transformJSON(inputString);
43+
const result = transformJSON(inputString);
4544

46-
const expectedOutput = {
47-
input: `{"test":"ok"}`,
48-
outExample: { test: 'ok' },
49-
};
45+
const expectedOutput = {
46+
input: `{"test":"ok"}`,
47+
outExample: { test: 'ok' },
48+
};
5049

51-
// Check if the result matches the expected output
52-
expect(result).toEqual(expectedOutput);
53-
});
50+
// Check if the result matches the expected output
51+
expect(result).toEqual(expectedOutput);
52+
});
5453

55-
test('single quotes', () => {
56-
// Sample JSON-like string with placeholders
54+
test('single quotes', () => {
55+
// Sample JSON-like string with placeholders
5756

58-
const inputString = `stack('test', {
59-
input: { test: 'ok' },
60-
outExample: { test: 'ok' }
61-
})`;
57+
const inputString = `stack('test', {
58+
input: { test: 'ok' },
59+
outExample: { test: 'ok' }
60+
})`;
6261

63-
const result = transformJSON(inputString);
62+
const result = transformJSON(inputString);
6463

65-
const expectedOutput = {
66-
input: `{"test":"ok"}`,
67-
outExample: { test: 'ok' },
68-
};
64+
const expectedOutput = {
65+
input: `{"test":"ok"}`,
66+
outExample: { test: 'ok' },
67+
};
6968

70-
// Check if the result matches the expected output
71-
expect(result).toEqual(expectedOutput);
72-
});
73-
});
69+
// Check if the result matches the expected output
70+
expect(result).toEqual(expectedOutput);
71+
});

0 commit comments

Comments
 (0)