diff --git a/src/infer/inferTitle.test.js b/src/infer/inferTitle.test.js new file mode 100644 index 0000000..700cc77 --- /dev/null +++ b/src/infer/inferTitle.test.js @@ -0,0 +1,21 @@ +import axios from 'axios'; +import inferTitle from './inferTitle'; + +jest.mock('axios', () => + jest.fn(() => + Promise.resolve({ + data: ` + + + TEST_TITLE + + `, + }), + ), +); + +test('it returns the correct title', async () => { + const result = await inferTitle('someurl'); + expect(axios).toHaveBeenCalledTimes(1); + expect(result).toBe('TEST_TITLE'); +});