From 6bd5ee4201a4d6634386f5beef7c3c45bd18f2d1 Mon Sep 17 00:00:00 2001 From: Kia Lam Date: Wed, 13 Mar 2019 17:12:16 -0400 Subject: [PATCH] Move test for AccessList. --- .../OrganizationAccessList.test.jsx} | 42 +++++++++---------- 1 file changed, 21 insertions(+), 21 deletions(-) rename __tests__/{components/AccessList.test.jsx => pages/Organizations/components/OrganizationAccessList.test.jsx} (84%) diff --git a/__tests__/components/AccessList.test.jsx b/__tests__/pages/Organizations/components/OrganizationAccessList.test.jsx similarity index 84% rename from __tests__/components/AccessList.test.jsx rename to __tests__/pages/Organizations/components/OrganizationAccessList.test.jsx index 77aff16344..82a4c452c6 100644 --- a/__tests__/components/AccessList.test.jsx +++ b/__tests__/pages/Organizations/components/OrganizationAccessList.test.jsx @@ -3,7 +3,7 @@ import { mount } from 'enzyme'; import { MemoryRouter } from 'react-router-dom'; import { I18nProvider } from '@lingui/react'; -import AccessList from '../../src/components/AccessList'; +import OrganizationAccessList from '../../../../src/pages/Organizations/components/OrganizationAccessList'; const mockData = [ { @@ -25,12 +25,12 @@ const mockData = [ } ]; -describe('', () => { +describe('', () => { test('initially renders succesfully', () => { mount( - {}} @@ -45,7 +45,7 @@ describe('', () => { const wrapper = mount( - ({ data: { count: 1, results: mockData } })} @@ -53,7 +53,7 @@ describe('', () => { /> - ).find('AccessList'); + ).find('OrganizationAccessList'); setImmediate(() => { expect(wrapper.state().results).toEqual(mockData); @@ -62,12 +62,12 @@ describe('', () => { }); test('onExpand and onCompact methods called when user clicks on Expand and Compact icons respectively', async (done) => { - const onExpand = jest.spyOn(AccessList.prototype, 'onExpand'); - const onCompact = jest.spyOn(AccessList.prototype, 'onCompact'); + const onExpand = jest.spyOn(OrganizationAccessList.prototype, 'onExpand'); + const onCompact = jest.spyOn(OrganizationAccessList.prototype, 'onCompact'); const wrapper = mount( - ({ data: { count: 1, results: mockData } })} @@ -75,7 +75,7 @@ describe('', () => { /> - ).find('AccessList'); + ).find('OrganizationAccessList'); expect(onExpand).not.toHaveBeenCalled(); expect(onCompact).not.toHaveBeenCalled(); @@ -90,11 +90,11 @@ describe('', () => { }); test('onSort being passed properly to DataListToolbar component', async (done) => { - const onSort = jest.spyOn(AccessList.prototype, 'onSort'); + const onSort = jest.spyOn(OrganizationAccessList.prototype, 'onSort'); const wrapper = mount( - ({ data: { count: 1, results: mockData } })} @@ -102,7 +102,7 @@ describe('', () => { /> - ).find('AccessList'); + ).find('OrganizationAccessList'); expect(onSort).not.toHaveBeenCalled(); setImmediate(() => { @@ -117,7 +117,7 @@ describe('', () => { const wrapper = mount( - ({ data: { count: 1, results: mockData } })} @@ -125,7 +125,7 @@ describe('', () => { /> - ).find('AccessList'); + ).find('OrganizationAccessList'); setImmediate(() => { const { results } = wrapper.state(); @@ -137,13 +137,13 @@ describe('', () => { }); test('test handleWarning, confirmDelete, and removeRole methods for Alert component', (done) => { - const handleWarning = jest.spyOn(AccessList.prototype, 'handleWarning'); - const confirmDelete = jest.spyOn(AccessList.prototype, 'confirmDelete'); - const removeRole = jest.spyOn(AccessList.prototype, 'removeAccessRole'); + const handleWarning = jest.spyOn(OrganizationAccessList.prototype, 'handleWarning'); + const confirmDelete = jest.spyOn(OrganizationAccessList.prototype, 'confirmDelete'); + const removeRole = jest.spyOn(OrganizationAccessList.prototype, 'removeAccessRole'); const wrapper = mount( - ({ data: { count: 1, results: mockData } })} @@ -151,7 +151,7 @@ describe('', () => { /> - ).find('AccessList'); + ).find('OrganizationAccessList'); expect(handleWarning).not.toHaveBeenCalled(); expect(confirmDelete).not.toHaveBeenCalled(); expect(removeRole).not.toHaveBeenCalled(); @@ -172,7 +172,7 @@ describe('', () => { const wrapper = mount( - ({ data: { count: 1, results: mockData } })} @@ -180,7 +180,7 @@ describe('', () => { /> - ).find('AccessList'); + ).find('OrganizationAccessList'); setImmediate(() => { const expected = [