huridocs/uwazi

View on GitHub
app/react/Library/specs/LibraryTable.spec.js

Summary

Maintainability
A
0 mins
Test Coverage
Definition for rule 'node/no-restricted-import' was not found.
import React from 'react';
import { shallow } from 'enzyme';
import { LibraryTableComponent } from 'app/Library/LibraryTable';
import RouteHandler from 'app/App/RouteHandler';
import DocumentsList from 'app/Library/components/DocumentsList';
 
jest.mock('app/appRoutes');
 
describe('LibraryTable', () => {
let component;
let context;
const props = { location: { query: { q: '(a:1)' } } };
const dispatchCallsOrder = [];
 
beforeEach(() => {
RouteHandler.renderedFromServer = true;
context = {
store: {
getState: () => ({}),
dispatch: jasmine.createSpy('dispatch').and.callFake(action => {
dispatchCallsOrder.push(action.type);
}),
},
};
 
Prop spreading is forbidden
component = shallow(<LibraryTableComponent {...props} />, { context });
});
 
it('should render the DocumentsList (by default)', () => {
expect(component.find(DocumentsList).length).toBe(1);
expect(component.find(DocumentsList).props().storeKey).toBe('library');
});
});