Skip to content

Commit 42f5ff9

Browse files
committed
Fix jest.spy
1 parent 4ce20fa commit 42f5ff9

File tree

4 files changed

+17
-17
lines changed

4 files changed

+17
-17
lines changed

packages/cli-doctor/src/tools/healthchecks/__tests__/androidSDK.test.ts

+5-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ describe('androidSDK', () => {
8181
'android/build.gradle': `
8282
buildscript {
8383
ext {
84-
buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
84+
buildToolsVersion = findProperty('android.buildToolsVersion') ?: '34.0.0'
8585
minSdkVersion = 16
8686
compileSdkVersion = 28
8787
targetSdkVersion = 28
@@ -123,8 +123,8 @@ describe('androidSDK', () => {
123123

124124
it('installs the SDK if it is missing on Windows', async () => {
125125
const loader = new tools.NoopLoader();
126-
const loaderSucceedSpy = jest.spyOn(loader, 'succeed');
127-
const loaderFailSpy = jest.spyOn(loader, 'fail');
126+
const loaderSuccessSpy = jest.spyOn(loader, 'success');
127+
const loaderErrorSpy = jest.spyOn(loader, 'error');
128128
const downloadAndUnzipSpy = jest
129129
.spyOn(downloadAndUnzip, 'downloadAndUnzip')
130130
.mockImplementation(() => Promise.resolve());
@@ -178,10 +178,10 @@ describe('androidSDK', () => {
178178
expect(requiredComponents.includes(call[0])).toBeTruthy();
179179
}
180180

181-
expect(loaderFailSpy).toHaveBeenCalledTimes(0);
181+
expect(loaderErrorSpy).toHaveBeenCalledTimes(0);
182182
expect(logSpy).toHaveBeenCalledTimes(0);
183183

184-
expect(loaderSucceedSpy).toBeCalledWith(
184+
expect(loaderSuccessSpy).toBeCalledWith(
185185
'Android SDK configured. You might need to restart your PC for all changes to take effect.',
186186
);
187187
});

packages/cli-doctor/src/tools/healthchecks/__tests__/androidStudio.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,8 @@ describe('androidStudio', () => {
5353

5454
it('downloads and unzips Android Studio on Windows when missing', async () => {
5555
const loader = new NoopLoader();
56-
const loaderSucceedSpy = jest.spyOn(loader, 'succeed');
57-
const loaderFailSpy = jest.spyOn(loader, 'fail');
56+
const loaderSuccessSpy = jest.spyOn(loader, 'success');
57+
const loaderErrorSpy = jest.spyOn(loader, 'error');
5858
const downloadAndUnzipSpy = jest
5959
.spyOn(downloadAndUnzip, 'downloadAndUnzip')
6060
.mockImplementation(() => Promise.resolve());
@@ -65,10 +65,10 @@ describe('androidStudio', () => {
6565
environmentInfo,
6666
});
6767

68-
expect(loaderFailSpy).toHaveBeenCalledTimes(0);
68+
expect(loaderErrorSpy).toHaveBeenCalledTimes(0);
6969
expect(logSpy).toHaveBeenCalledTimes(0);
7070
expect(downloadAndUnzipSpy).toBeCalledTimes(1);
71-
expect(loaderSucceedSpy).toBeCalledWith(
71+
expect(loaderSuccessSpy).toBeCalledWith(
7272
`Android Studio installed successfully in "${
7373
downloadAndUnzipSpy.mock.calls[0][0].installPath || ''
7474
}".`,

packages/cli-doctor/src/tools/healthchecks/__tests__/jdk.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ describe('jdk', () => {
7373

7474
it('downloads and unzips JDK on Windows when missing', async () => {
7575
const loader = new tools.NoopLoader();
76-
const loaderSucceedSpy = jest.spyOn(loader, 'succeed');
77-
const loaderFailSpy = jest.spyOn(loader, 'fail');
76+
const loaderSuccessSpy = jest.spyOn(loader, 'success');
77+
const loaderErrorSpy = jest.spyOn(loader, 'error');
7878
const downloadAndUnzipSpy = jest
7979
.spyOn(downloadAndUnzip, 'downloadAndUnzip')
8080
.mockImplementation(() => Promise.resolve());
@@ -85,10 +85,10 @@ describe('jdk', () => {
8585
environmentInfo,
8686
});
8787

88-
expect(loaderFailSpy).toHaveBeenCalledTimes(0);
88+
expect(loaderErrorSpy).toHaveBeenCalledTimes(0);
8989
expect(logSpy).toHaveBeenCalledTimes(0);
9090
expect(downloadAndUnzipSpy).toBeCalledTimes(1);
91-
expect(loaderSucceedSpy).toBeCalledWith(
91+
expect(loaderSuccessSpy).toBeCalledWith(
9292
'JDK installed successfully. Please restart your shell to see the changes',
9393
);
9494
});

packages/cli-doctor/src/tools/healthchecks/__tests__/watchman.test.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ describe('watchman', () => {
8282
});
8383

8484
const loaderSpy = new NoopLoader();
85-
const loaderSucceedSpy = jest.spyOn(loaderSpy, 'succeed');
86-
const loaderFailSpy = jest.spyOn(loaderSpy, 'fail');
85+
const loaderSuccessSpy = jest.spyOn(loaderSpy, 'success');
86+
const loaderErrorSpy = jest.spyOn(loaderSpy, 'error');
8787
const brewInstallSpy = jest
8888
.spyOn(brewInstall, 'brewInstall')
8989
.mockImplementation(({loader}) => {
@@ -102,9 +102,9 @@ describe('watchman', () => {
102102
value: originalPlatform,
103103
});
104104

105-
expect(loaderFailSpy).toHaveBeenCalledTimes(0);
105+
expect(loaderErrorSpy).toHaveBeenCalledTimes(0);
106106
expect(logSpy).toHaveBeenCalledTimes(0);
107107
expect(brewInstallSpy).toBeCalledTimes(1);
108-
expect(loaderSucceedSpy).toBeCalledTimes(1);
108+
expect(loaderSuccessSpy).toBeCalledTimes(1);
109109
});
110110
});

0 commit comments

Comments
 (0)