33 */
44import React from "react" ;
55import { mount } from "enzyme" ;
6- import { render , screen , waitForElementToBeRemoved , waitFor , cleanup } from "@testing-library/react" ;
7- import userEvent from "@testing-library/user-event"
8- import { AdminCampaignList } from "../../src/containers/AdminCampaignList" ;
6+ import { act } from "react-dom/test-utils" ;
7+ import {
8+ render ,
9+ screen ,
10+ waitFor ,
11+ cleanup
12+ } from "@testing-library/react" ;
13+ import userEvent from "@testing-library/user-event" ;
914import { StyleSheetTestUtils } from "aphrodite" ;
10- import { act } from 'react-dom/test-utils' ;
15+
16+ import { AdminCampaignList } from "../../src/containers/AdminCampaignList" ;
1117
1218// https://github.com/Khan/aphrodite/issues/62#issuecomment-267026726
1319beforeEach ( ( ) => {
1420 StyleSheetTestUtils . suppressStyleInjection ( ) ;
1521} ) ;
1622afterEach ( ( ) => {
1723 StyleSheetTestUtils . clearBufferAndResumeStyleInjection ( ) ;
18- cleanup ( )
24+ cleanup ( ) ;
1925} ) ;
2026
2127describe ( "CampaignList" , ( ) => {
2228 const params = {
2329 adminPerms : true ,
24- organizationId : '77'
30+ organizationId : "77"
2531 } ;
2632
2733 const mutations = {
@@ -121,8 +127,8 @@ describe("CampaignList", () => {
121127
122128 describe ( "Campaign list sorting" , ( ) => {
123129 const campaignWithCreator = {
124- id : '1' ,
125- title : ' test' ,
130+ id : "1" ,
131+ title : " test" ,
126132 creator : {
127133 displayName : "Lorem Ipsum"
128134 } ,
@@ -135,7 +141,7 @@ describe("CampaignList", () => {
135141
136142 const data = {
137143 organization : {
138- id : '1' ,
144+ id : "1" ,
139145 cacheable : 2 ,
140146 campaigns : {
141147 campaigns : [ campaignWithCreator ] ,
@@ -153,37 +159,49 @@ describe("CampaignList", () => {
153159 StyleSheetTestUtils . suppressStyleInjection ( ) ;
154160 act ( ( ) => {
155161 render (
156- < AdminCampaignList data = { data } mutations = { mutations } params = { params } />
162+ < AdminCampaignList
163+ data = { data }
164+ mutations = { mutations }
165+ params = { params }
166+ />
157167 ) ;
158- } )
168+ } ) ;
159169
160170 act ( ( ) => {
161171 userEvent . click (
162- screen . getByRole (
163- 'button' ,
164- { name : / s o r t : c r e a t e d , n e w e s t / i}
165- ) , { skipHover : true } ) ;
166- } )
172+ screen . getByRole ( "button" , { name : / s o r t : c r e a t e d , n e w e s t / i } ) ,
173+ { skipHover : true }
174+ ) ;
175+ } ) ;
167176
168177 act ( ( ) => {
169178 userEvent . click (
170- screen . getByRole (
171- 'option' ,
172- { name : / s o r t : t i m e z o n e / i}
173- ) , { skipHover : true } ) ;
174- } )
179+ screen . getByRole ( "option" , { name : / s o r t : t i m e z o n e / i } ) ,
180+ { skipHover : true }
181+ ) ;
182+ } ) ;
175183
176- await waitFor ( ( ) => expect ( screen . getByRole ( 'columnheader' , { name : / t i m e z o n e / i} ) ) . toBeTruthy ( ) ) ;
184+ await waitFor ( ( ) =>
185+ expect (
186+ screen . getByRole ( "columnheader" , { name : / t i m e z o n e / i } )
187+ ) . toBeTruthy ( )
188+ ) ;
177189 } ) ;
178190
179191 test ( "Timezone column is hidden when it isn't the current sort" , ( ) => {
180192 StyleSheetTestUtils . suppressStyleInjection ( ) ;
181193 act ( ( ) => {
182194 render (
183- < AdminCampaignList data = { data } mutations = { mutations } params = { params } />
195+ < AdminCampaignList
196+ data = { data }
197+ mutations = { mutations }
198+ params = { params }
199+ />
184200 ) ;
185- } )
186- const timezoneButton = screen . queryByText ( 'columnheader' , { name : / t i m e z o n e / i } ) ;
201+ } ) ;
202+ const timezoneButton = screen . queryByText ( "columnheader" , {
203+ name : / t i m e z o n e / i
204+ } ) ;
187205 expect ( timezoneButton ) . toBeNull ( ) ;
188206 } ) ;
189207 } ) ;
0 commit comments