mirror of
https://github.com/Llewellynvdm/nativefier.git
synced 2024-09-28 04:19:01 +00:00
Fix inferTitle test broken on Node 8
This commit is contained in:
parent
20de73c559
commit
d6e7aa6f41
@ -1,17 +1,22 @@
|
||||
import axios from 'axios';
|
||||
import axios, { AxiosResponse } from 'axios';
|
||||
|
||||
import { inferTitle } from './inferTitle';
|
||||
|
||||
test('it returns the correct title', async () => {
|
||||
const axiosGetMock = jest.spyOn(axios, 'get');
|
||||
axiosGetMock.mockResolvedValue({
|
||||
const mockedResponse: AxiosResponse<string> = {
|
||||
data: `
|
||||
<HTML>
|
||||
<head>
|
||||
<title>TEST_TITLE</title>
|
||||
</head>
|
||||
</HTML>`,
|
||||
});
|
||||
status: 200,
|
||||
statusText: 'OK',
|
||||
headers: {},
|
||||
config: {},
|
||||
};
|
||||
axiosGetMock.mockResolvedValue(mockedResponse);
|
||||
const result = await inferTitle('someurl');
|
||||
|
||||
expect(axiosGetMock).toHaveBeenCalledTimes(1);
|
||||
|
Loading…
Reference in New Issue
Block a user