@@ -15,7 +15,7 @@ import { renderHook } from '../../../test/test-utils';
15
15
import {
16
16
GEN3_COHORT_MIDDLEWARE_API ,
17
17
useGetCohortDefinitionsQuery ,
18
- useGetSourcesQuery
18
+ useGetSourcesQuery ,
19
19
} from './cohortApi' ;
20
20
21
21
const server = setupServer ( ) ;
@@ -42,7 +42,8 @@ const cohortDefinitionAndStatsData = {
42
42
cohort_name : 'team2 - test new cohort - small' ,
43
43
size : 80 ,
44
44
} ,
45
- ] } ;
45
+ ] ,
46
+ } ;
46
47
47
48
describe ( 'cohortApi' , ( ) => {
48
49
beforeAll ( ( ) => {
@@ -100,17 +101,16 @@ describe('cohortApi', () => {
100
101
} ) ;
101
102
102
103
it ( 'returns error if project id not accessible ' , async ( ) => {
103
-
104
104
const sourceId = '1234567890' ;
105
105
const selectedTeamProject = 'project2345' ;
106
106
107
107
server . use (
108
108
http . get (
109
109
`${ GEN3_COHORT_MIDDLEWARE_API } /cohortdefinition-stats/by-source-id/1234567890/by-team-project` ,
110
110
( ) => {
111
- return new HttpResponse ( null , {
112
- status : 403 ,
113
- } ) ;
111
+ return new HttpResponse ( null , {
112
+ status : 403 ,
113
+ } ) ;
114
114
} ,
115
115
) ,
116
116
) ;
@@ -127,24 +127,21 @@ describe('cohortApi', () => {
127
127
isFetching : false ,
128
128
isSuccess : false ,
129
129
isLoading : false ,
130
- error : { status : 403 }
130
+ error : { status : 403 } ,
131
131
} ) ;
132
132
} ) ;
133
133
134
134
it ( 'test for successful useGetSources ' , async ( ) => {
135
- const data = { "sources" :[ { "source_id" :123 , "source_name" :"MVP-batch19000101" } ] } ;
135
+ const data = {
136
+ sources : [ { source_id : 123 , source_name : 'MVP-batch19000101' } ] ,
137
+ } ;
136
138
server . use (
137
- http . get (
138
- `${ GEN3_COHORT_MIDDLEWARE_API } /sources` ,
139
- ( ) => {
140
- return HttpResponse . json ( data ) ;
141
- } ,
142
- ) ,
139
+ http . get ( `${ GEN3_COHORT_MIDDLEWARE_API } /sources` , ( ) => {
140
+ return HttpResponse . json ( data ) ;
141
+ } ) ,
143
142
) ;
144
143
145
- const { result } = renderHook ( ( ) =>
146
- useGetSourcesQuery ( ) ,
147
- ) ;
144
+ const { result } = renderHook ( ( ) => useGetSourcesQuery ( ) ) ;
148
145
149
146
expect ( result . current . isFetching ) . toBe ( true ) ;
150
147
@@ -154,7 +151,7 @@ describe('cohortApi', () => {
154
151
isFetching : false ,
155
152
isSuccess : true ,
156
153
isLoading : false ,
157
- data : data
154
+ data : data ,
158
155
} ) ;
159
156
} ) ;
160
157
} ) ;
0 commit comments