Files
frontend-app-ora-grading/src/components/FilePreview/BaseRenderers/TXTRenderer.test.jsx
leangseu-edx c5bf0a7d11 feat: add file renderer that support common error handling and loading banner (#42)
* feat: add file renderer that support common error handling and loading banner

* chore: use axios instead of get from utils

* chore: fixed typo and update snapshots
2022-01-19 12:34:44 -05:00

26 lines
587 B
JavaScript

import React from 'react';
import { shallow } from 'enzyme';
import TXTRenderer from './TXTRenderer';
jest.mock('axios', () => ({
get: jest.fn((...args) => Promise.resolve({ data: `Content of ${args}` })),
}));
describe('TXT Renderer Component', () => {
const props = {
url: 'some_url.txt',
};
props.onError = jest.fn().mockName('this.props.onError');
props.onSuccess = jest.fn().mockName('this.props.onSuccess');
let el;
beforeEach(() => {
el = shallow(<TXTRenderer {...props} />);
});
test('snapshot', () => {
expect(el).toMatchSnapshot();
});
});