Skip to content

Commit 2d91f2a

Browse files
committed
test: fix deprecated funciton toBeCalled* with toHaveBeenCalled*
1 parent 2c3b9f1 commit 2d91f2a

4 files changed

Lines changed: 18 additions & 18 deletions

File tree

test/lib/npcheck-env.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ it('should clean the npcheck-env directory', () => {
3939
const envPath = path.resolve(process.cwd(), 'npcheck-env');
4040
cleanEnvDirectory();
4141

42-
expect(fs.existsSync).toBeCalled();
42+
expect(fs.existsSync).toHaveBeenCalled();
4343
expect(fs.existsSync).toHaveBeenCalledWith(envPath);
4444
expect(fs.rmdirSync).toHaveBeenCalled();
4545
expect(fs.rmdirSync).toHaveBeenCalledWith(envPath, { recursive: true });
@@ -53,7 +53,7 @@ it('should not call fs.rmdirSync if npcheck-env does not exists', () => {
5353
const envPath = path.resolve(process.cwd(), 'npcheck-env');
5454
cleanEnvDirectory();
5555

56-
expect(fs.existsSync).toBeCalled();
56+
expect(fs.existsSync).toHaveBeenCalled();
5757
expect(fs.existsSync).toHaveBeenCalledWith(envPath);
5858
expect(fs.rmdirSync).toHaveBeenCalledTimes(0);
5959
});

test/plugins/archive.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ it('should return null if the package is not archived', async () => {
3333
const result = await archivePlugin(pkg, null, {});
3434

3535
expect(network.fetchGithub).toHaveBeenCalled();
36-
expect(network.fetchGithub).toBeCalledWith('/repos/n/n', undefined);
36+
expect(network.fetchGithub).toHaveBeenCalledWith('/repos/n/n', undefined);
3737
expect(result).toBe(null);
3838
});
3939

@@ -74,7 +74,7 @@ it('should return error result if the package is archived', async () => {
7474
const result = await archivePlugin(pkg, null, {});
7575

7676
expect(network.fetchGithub).toHaveBeenCalled();
77-
expect(network.fetchGithub).toBeCalledWith('/repos/n/n', undefined);
77+
expect(network.fetchGithub).toHaveBeenCalledWith('/repos/n/n', undefined);
7878
expect(result.type).toBe('error');
7979
});
8080

test/plugins/citgm.test.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ it('should succeed if package is tested by community CITGM', async () => {
4242

4343
const result = await citgmPlugin(pkg, null, {});
4444
expect(network.fetchGithub).toHaveBeenCalled();
45-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
45+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
4646
expect(format.success).toHaveBeenCalled();
4747
expect(result).toBeNull();
4848
});
@@ -56,7 +56,7 @@ it('should warn if package is not tested by community CITGM', async () => {
5656

5757
const result = await citgmPlugin(pkg, null, {});
5858
expect(network.fetchGithub).toHaveBeenCalled();
59-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
59+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
6060
expect(format.warning).toHaveBeenCalled();
6161
expect(result.type).toBe('warning');
6262
});
@@ -70,7 +70,7 @@ it('should warn if package is skipped everywhere', async () => {
7070

7171
const result = await citgmPlugin(pkg, null, {});
7272
expect(network.fetchGithub).toHaveBeenCalled();
73-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
73+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
7474
expect(format.warning).toHaveBeenCalled();
7575
expect(result.type).toBe('warning');
7676
});
@@ -84,7 +84,7 @@ it('should warn if package is skipped everywhere (array version)', async () => {
8484

8585
const result = await citgmPlugin(pkg, null, {});
8686
expect(network.fetchGithub).toHaveBeenCalled();
87-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
87+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
8888
expect(format.warning).toHaveBeenCalled();
8989
expect(result.type).toBe('warning');
9090
});
@@ -98,7 +98,7 @@ it('should warn if package is skipped for in support versions', async () => {
9898

9999
const result = await citgmPlugin(pkg, null, {});
100100
expect(network.fetchGithub).toHaveBeenCalled();
101-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
101+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
102102
expect(format.warning).toHaveBeenCalled();
103103
expect(result.type).toBe('warning');
104104
});
@@ -112,7 +112,7 @@ it('should warn if package is skipped for in support versions (array version)',
112112

113113
const result = await citgmPlugin(pkg, null, {});
114114
expect(network.fetchGithub).toHaveBeenCalled();
115-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
115+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
116116
expect(format.warning).toHaveBeenCalled();
117117
expect(result.type).toBe('warning');
118118
});
@@ -126,7 +126,7 @@ it('should succeed if package if skips do not affect in support versions', async
126126

127127
const result = await citgmPlugin(pkg, null, {});
128128
expect(network.fetchGithub).toHaveBeenCalled();
129-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
129+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
130130
expect(format.success).toHaveBeenCalled();
131131
expect(result).toBeNull();
132132
});
@@ -140,7 +140,7 @@ it('should succeed if package if skips do not affect in support versions (array
140140

141141
const result = await citgmPlugin(pkg, null, {});
142142
expect(network.fetchGithub).toHaveBeenCalled();
143-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
143+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
144144
expect(format.success).toHaveBeenCalled();
145145
expect(result).toBeNull();
146146
});
@@ -154,7 +154,7 @@ it('should succeed if package if skips are only platform specific', async () =>
154154

155155
const result = await citgmPlugin(pkg, null, {});
156156
expect(network.fetchGithub).toHaveBeenCalled();
157-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
157+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
158158
expect(format.success).toHaveBeenCalled();
159159
expect(result).toBeNull();
160160
});
@@ -168,7 +168,7 @@ it('should succeed if package if skips are only platform specific (array version
168168

169169
const result = await citgmPlugin(pkg, null, {});
170170
expect(network.fetchGithub).toHaveBeenCalled();
171-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
171+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
172172
expect(format.success).toHaveBeenCalled();
173173
expect(result).toBeNull();
174174
});
@@ -182,7 +182,7 @@ it('should not perform partial matches', async () => {
182182

183183
await citgmPlugin(pkg, null, {});
184184
expect(network.fetchGithub).toHaveBeenCalled();
185-
expect(network.fetchGithub).toBeCalledWith(CITGM_LOOKUP_URL, undefined);
185+
expect(network.fetchGithub).toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
186186
expect(format.warning).toHaveBeenCalled();
187187
});
188188

@@ -201,6 +201,6 @@ it('should skip module if specified in citgm.skip list', async () => {
201201

202202
expect(await citgmPlugin(pkg, config, {})).toBeNull();
203203
expect(network.fetchGithub).not.toHaveBeenCalled();
204-
expect(network.fetchGithub).not.toBeCalledWith(CITGM_LOOKUP_URL, undefined);
204+
expect(network.fetchGithub).not.toHaveBeenCalledWith(CITGM_LOOKUP_URL, undefined);
205205
expect(format.success).not.toHaveBeenCalled();
206206
});

test/plugins/licenseTree.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ it('should return an empty list when the dep-tree has acceptable licenses', asyn
4949
const result = await licenseTreePlugin(testEnv.pkg, testEnv.config);
5050

5151
expect(result).toEqual([]);
52-
expect(success).toBeCalledTimes(2);
52+
expect(success).toHaveBeenCalledTimes(2);
5353
});
5454

5555
it('should return a list of errors when deps have non-acceptable licenses', async () => {
@@ -126,7 +126,7 @@ it('should return an empty list when deps have "local" acceptable licenses', asy
126126
const result = await licenseTreePlugin(testEnv.pkg, testEnv.config);
127127

128128
expect(result).toEqual([]);
129-
expect(success).toBeCalledTimes(2);
129+
expect(success).toHaveBeenCalledTimes(2);
130130
});
131131

132132
it('should return a list of warnings when deps have "non-decidable" licenses', async () => {

0 commit comments

Comments
 (0)