mitragyna
Version:
A library for managing ActiveResources as React components
39 lines (29 loc) • 879 B
JavaScript
import React, { PureComponent } from 'react';
import { Resource, Input } from '../build/mitragyna.min';
import axios from 'axios';
import library from './support/resourceLibrary';
import orderFixture from './support/fixtures/orders/find.json';
describe('Resource', () => {
let wrapper;
let order;
beforeEach(async () => {
axios._setMockResponses({
'/orders/:id/': { status: 200, data: orderFixture },
});
order = await library.Order.find('1');
let props = {
component: class extends PureComponent {
render() {
return <section>
<Input type="text" name="quantity"></Input>
</section>
}
},
subject: order
};
wrapper = shallow(<Resource {...props}></Resource>);
});
it('renders component prop', () => {
expect(wrapper).toContainReact(<Input type="text" name="quantity"></Input>);
});
});