Skip to content

Commit 8c329b6

Browse files
committed
Fix errors and add test cases
1 parent 4866282 commit 8c329b6

File tree

3 files changed

+44
-4
lines changed

3 files changed

+44
-4
lines changed

jest.config.js

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,8 @@ module.exports = {
44
verbose: true,
55
preset: 'ts-jest/presets/js-with-babel',
66
transform: {
7-
<<<<<<< HEAD
87
'^.+\\.tsx?$': 'ts-jest',
98
'^.+\\.(js|jsx)$': 'babel-jest'
10-
=======
11-
'^.+\\.tsx?$': 'ts-jest'
12-
>>>>>>> Remove unnecessary setup
139
},
1410
setupFiles: ['<rootDir>/testutils/jest-setup-files.js'],
1511
moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@
7575
"eslint": "^7.5.0",
7676
"@babel/core": "^7",
7777
"@babel/preset-env": "^7",
78+
"@jupyterlab/testutils": "^2.2.7",
7879
"@testing-library/react": "^11.1.1",
7980
"@types/jest": "^26.0.15",
8081
"eslint-config-prettier": "^6.10.1",

test/codeSnippetContentsService.test.ts

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,3 +130,46 @@ test('test delete', async () => {
130130
const path = 'foo/test';
131131
await codeSnippetContentsService.delete(path);
132132
});
133+
134+
// test('test save', () => {
135+
// const newContent = {
136+
// name: 'new_array',
137+
// description:
138+
// 'Scala program of array. Declare, print, and calculate sum of all elements.',
139+
// language: 'Scala',
140+
// code: [],
141+
// id: 11,
142+
// tags: ['math']
143+
// };
144+
// codeSnippetContentsService.save('snippets/sum_array.json', {
145+
// type: 'file',
146+
// format: 'text',
147+
// content: JSON.stringify(newContent)
148+
// });
149+
150+
// const data = codeSnippetContentsService.getData(
151+
// 'snippets/sum_array.json',
152+
// 'file'
153+
// );
154+
155+
// data.then(val => expect(JSON.parse(val.content).code.length).toBe(0));
156+
// });
157+
158+
// test('test rename', () => {
159+
// const oldPath = 'snippets/sum_array.json';
160+
// const newPath = 'snippets/new_array.json';
161+
// codeSnippetContentsService.rename(oldPath, newPath);
162+
163+
// codeSnippetContentsService
164+
// .getData(newPath, 'file')
165+
// .then(val => expect(val).toBeTruthy());
166+
// });
167+
168+
// test('test delete', () => {
169+
// const path = 'snippets/sum_array.json';
170+
// codeSnippetContentsService.delete(path);
171+
172+
// codeSnippetContentsService
173+
// .getData(path, 'file')
174+
// .then(val => expect(val).toBeNull());
175+
// });

0 commit comments

Comments
 (0)