Skip to content

Commit 4d7e71b

Browse files
committed
working test
1 parent a19197c commit 4d7e71b

File tree

1 file changed

+13
-13
lines changed

1 file changed

+13
-13
lines changed

__tests__/pause-client.test.ts

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,33 +2,33 @@ import { expect, jest, test, describe } from '@jest/globals';
22

33
import * as HttpClient from '@actions/http-client';
44

5-
import { PAUSEClient } from '~/pause-client';
6-
75
describe('normal', () => {
86
test('downloadUrl', async () => {
97
jest.mock('@actions/http-client', () => ({
108
...HttpClient,
11-
"HttpClient": jest.fn().mockImplementation(() => ({
12-
post: jest.fn(),
13-
})),
9+
HttpClient: jest.fn().mockImplementation(() => {
10+
const resp = {
11+
message: {
12+
statusCode: 200,
13+
},
14+
readBody: () => 'Query succeeded',
15+
};
16+
return {
17+
post: jest.fn().mockImplementation(() => Promise.resolve(resp)),
18+
};
19+
}),
1420
}));
1521

1622
const { PAUSEClient } = await import('~/pause-client');
1723

18-
const client = new PAUSEClient('HAARG', 'my-password');
19-
20-
// client.uploadUrl = 'http://localhost:5555/';
24+
const client = new PAUSEClient('PAUSEUSER', 'my-password');
2125

22-
/*
2326
const upload = await client.upload({
2427
file: './README.md',
2528
});
2629

27-
console.log(upload);
2830
expect(upload.downloadUrl()).toBe(
29-
'https://www.cpan.org/authors/id/H/HA/HAARG/README.md'
31+
'https://www.cpan.org/authors/id/P/PA/PAUSEUSER/README.md'
3032
);
31-
*/
32-
expect(true).toBe(true);
3333
});
3434
});

0 commit comments

Comments
 (0)