1
0
mirror of https://github.com/jiahaog/Nativefier synced 2024-06-26 07:38:59 +02:00
Nativefier/src/infer/inferTitle.test.js
2018-06-10 11:00:16 -07:00

22 lines
447 B
JavaScript

import axios from 'axios';
import inferTitle from './inferTitle';
jest.mock('axios', () =>
jest.fn(() =>
Promise.resolve({
data: `
<HTML>
<head>
<title>TEST_TITLE</title>
</head>
</HTML>`,
}),
),
);
test('it returns the correct title', async () => {
const result = await inferTitle('someurl');
expect(axios).toHaveBeenCalledTimes(1);
expect(result).toBe('TEST_TITLE');
});