Skip to content

Commit 4b80f30

Browse files
committed
Fix tests
1 parent a4466b5 commit 4b80f30

29 files changed

+1114
-1246
lines changed

jest.config.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const esModules = [
66
'@jupyterlab/',
77
'lib0',
88
'nanoid',
9+
'nbdime',
910
'vscode-ws-jsonrpc',
1011
'y-protocols',
1112
'y-websocket',
@@ -30,6 +31,8 @@ module.exports = {
3031
'<rootDir>/jupyter-config',
3132
'<rootDir>/ui-tests'
3233
],
34+
reporters: ['default', 'github-actions'],
35+
setupFiles: ['<rootDir>/testutils/jest-setup-files.js'],
3336
testRegex: 'src/.*/.*.spec.ts[x]?$',
3437
transformIgnorePatterns: [`/node_modules/(?!${esModules}).+`]
3538
};

jupyterlab_git/tests/test_handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ async def test_all_history_handler_localbranch(mock_git, jp_fetch, jp_root_dir):
5151
mock_git.status.return_value = maybe_future(status)
5252

5353
# When
54+
body = {"history_count": 25}
5455
response = await jp_fetch(
5556
NAMESPACE, local_path.name, "all_history", body=json.dumps(body), method="POST"
5657
)

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,10 @@
102102
"@babel/preset-env": "^7.0.0",
103103
"@jupyterlab/builder": "^4.0.0",
104104
"@jupyterlab/testutils": "^4.0.0",
105+
"@testing-library/jest-dom": "^6.1.4",
106+
"@testing-library/react": "^14.0.0",
107+
"@testing-library/user-event": "^14.5.1",
105108
"@types/diff-match-patch": "^1.0.32",
106-
"@types/enzyme": "^3.1.15",
107109
"@types/jest": "^29.2.0",
108110
"@types/json-schema": "^7.0.11",
109111
"@types/react": "^18.0.26",
@@ -114,10 +116,8 @@
114116
"@types/resize-observer-browser": "^0.1.7",
115117
"@typescript-eslint/eslint-plugin": "^6.1.0",
116118
"@typescript-eslint/parser": "^6.1.0",
117-
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
118119
"all-contributors-cli": "^6.14.0",
119120
"css-loader": "^6.7.1",
120-
"enzyme": "^3.7.0",
121121
"eslint": "^8.36.0",
122122
"eslint-config-prettier": "^8.8.0",
123123
"eslint-plugin-prettier": "^5.0.0",
@@ -126,11 +126,11 @@
126126
"husky": "^8.0.3",
127127
"identity-obj-proxy": "^3.0.0",
128128
"jest": "^29.2.0",
129-
"jest-fetch-mock": "^3.0.0",
130129
"lint-staged": "^13.2.3",
131130
"mkdirp": "^1.0.3",
132131
"npm-run-all": "^4.1.5",
133132
"prettier": "^3.0.0",
133+
"resize-observer-polyfill": "^1.5.1",
134134
"rimraf": "^5.0.1",
135135
"source-map-loader": "^1.0.2",
136136
"style-loader": "^3.3.1",
@@ -139,7 +139,7 @@
139139
"stylelint-config-standard": "^34.0.0",
140140
"stylelint-csstree-validator": "^3.0.0",
141141
"stylelint-prettier": "^4.0.0",
142-
"ts-jest": "^26.0.0",
142+
"ts-jest": "^29.1.0",
143143
"typescript": "~5.0.2",
144144
"yjs": "^13.5.40"
145145
},

src/__tests__/model.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ describe('IGitExtension', () => {
2929
responses: { ...defaultMockedResponses }
3030
};
3131

32-
mockGit.requestAPI.mockImplementation(mockedRequestAPI(mockResponses));
32+
mockGit.requestAPI.mockImplementation(mockedRequestAPI(mockResponses) as any);
3333

3434
model = new GitExtension(docmanager as any, docregistry as any);
3535
});

src/__tests__/plugin.spec.ts

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,23 @@ describe('plugin', () => {
3636
}
3737
} as unknown as jest.Mocked<IFileBrowserFactory>;
3838
settingRegistry = new SettingRegistry({
39-
connector: null
40-
}) as jest.Mocked<SettingRegistry>;
39+
connector: null as any
40+
}) as any;
4141
});
4242

4343
beforeEach(() => {
4444
jest.resetAllMocks();
4545
mockResponses = { responses: { ...defaultMockedResponses } };
46-
mockGit.requestAPI.mockImplementation(mockedRequestAPI(mockResponses));
46+
mockGit.requestAPI.mockImplementation(
47+
mockedRequestAPI(mockResponses) as any
48+
);
4749
});
4850

4951
describe('#activate', () => {
5052
it('should fail if no git is installed', async () => {
5153
// Given
5254
const endpoint = 'settings' + URLExt.objectToQueryString({ version });
53-
mockResponses.responses[endpoint] = {
55+
mockResponses.responses![endpoint] = {
5456
body: request => {
5557
return {
5658
gitVersion: null,
@@ -85,7 +87,7 @@ describe('plugin', () => {
8587
it('should fail if git version is < 2', async () => {
8688
// Given
8789
const endpoint = 'settings' + URLExt.objectToQueryString({ version });
88-
mockResponses.responses[endpoint] = {
90+
mockResponses.responses![endpoint] = {
8991
body: request => {
9092
return {
9193
gitVersion: '1.8.7',
@@ -119,7 +121,7 @@ describe('plugin', () => {
119121
it('should fail if server and extension version do not match', async () => {
120122
// Given
121123
const endpoint = 'settings' + URLExt.objectToQueryString({ version });
122-
mockResponses.responses[endpoint] = {
124+
mockResponses.responses![endpoint] = {
123125
body: request => {
124126
return {
125127
gitVersion: '2.22.0',
@@ -156,7 +158,7 @@ describe('plugin', () => {
156158
it('should fail if the server extension is not installed', async () => {
157159
// Given
158160
const endpoint = 'settings' + URLExt.objectToQueryString({ version });
159-
mockResponses.responses[endpoint] = {
161+
mockResponses.responses![endpoint] = {
160162
status: 404
161163
};
162164
const mockedErrorMessage = showErrorMessage as jest.MockedFunction<

0 commit comments

Comments
 (0)