@@ -29,11 +29,12 @@ import { X2ADatabaseService } from './services/X2ADatabaseService';
2929import { ProjectsPostRequest } from '@red-hat-developer-hub/backstage-plugin-x2a-common' ;
3030import { migrate } from './services/dbMigrate' ;
3131import { Knex } from 'knex' ;
32- import { nonExistentId } from './utils' ;
32+ import { LONG_TEST_TIMEOUT , nonExistentId } from './utils' ;
3333
3434const databases = TestDatabases . create ( {
3535 ids : [ 'SQLITE_3' , 'POSTGRES_18' ] ,
3636} ) ;
37+ const supportedDatabaseIds = databases . eachSupportedId ( ) ;
3738
3839const mockInputProject : ProjectsPostRequest = {
3940 name : 'Mock Project' ,
@@ -110,7 +111,7 @@ describe('createRouter', () => {
110111 } ;
111112 }
112113
113- it . each ( databases . eachSupportedId ( ) ) (
114+ it . each ( supportedDatabaseIds ) (
114115 'should query empty project list - %p' ,
115116 async databaseId => {
116117 const { client } = await createDatabase ( databaseId ) ;
@@ -122,9 +123,10 @@ describe('createRouter', () => {
122123 expect ( response . body . totalCount ) . toBe ( 0 ) ;
123124 expect ( response . body . items ) . toEqual ( [ ] ) ;
124125 } ,
126+ LONG_TEST_TIMEOUT ,
125127 ) ;
126128
127- it . each ( databases . eachSupportedId ( ) ) (
129+ it . each ( supportedDatabaseIds ) (
128130 'should create a project - %p' ,
129131 async databaseId => {
130132 const { client } = await createDatabase ( databaseId ) ;
@@ -140,9 +142,10 @@ describe('createRouter', () => {
140142 createdBy : 'user:default/mock' ,
141143 } ) ;
142144 } ,
145+ LONG_TEST_TIMEOUT ,
143146 ) ;
144147
145- it . each ( databases . eachSupportedId ( ) ) (
148+ it . each ( supportedDatabaseIds ) (
146149 'should not allow unauthenticated requests to create a project - %p' ,
147150 async databaseId => {
148151 const { client } = await createDatabase ( databaseId ) ;
@@ -161,7 +164,7 @@ describe('createRouter', () => {
161164 } ,
162165 ) ;
163166
164- it . each ( databases . eachSupportedId ( ) ) (
167+ it . each ( supportedDatabaseIds ) (
165168 'should allow users with x2aUserPermission to create projects - %p' ,
166169 async databaseId => {
167170 const { client } = await createDatabase ( databaseId ) ;
@@ -179,7 +182,7 @@ describe('createRouter', () => {
179182 } ,
180183 ) ;
181184
182- it . each ( databases . eachSupportedId ( ) ) (
185+ it . each ( supportedDatabaseIds ) (
183186 'should allow users with x2aAdminWritePermission to create projects - %p' ,
184187 async databaseId => {
185188 const { client } = await createDatabase ( databaseId ) ;
@@ -197,7 +200,7 @@ describe('createRouter', () => {
197200 } ,
198201 ) ;
199202
200- it . each ( databases . eachSupportedId ( ) ) (
203+ it . each ( supportedDatabaseIds ) (
201204 'should deny users without permissions from creating projects - %p' ,
202205 async databaseId => {
203206 const { client } = await createDatabase ( databaseId ) ;
@@ -217,7 +220,7 @@ describe('createRouter', () => {
217220 } ,
218221 ) ;
219222
220- it . each ( databases . eachSupportedId ( ) ) (
223+ it . each ( supportedDatabaseIds ) (
221224 'should get a project by id - %p' ,
222225 async databaseId => {
223226 const { client } = await createDatabase ( databaseId ) ;
@@ -244,7 +247,7 @@ describe('createRouter', () => {
244247 } ,
245248 ) ;
246249
247- it . each ( databases . eachSupportedId ( ) ) (
250+ it . each ( supportedDatabaseIds ) (
248251 'should fail for non-existent project - %p' ,
249252 async databaseId => {
250253 const { client } = await createDatabase ( databaseId ) ;
@@ -261,7 +264,7 @@ describe('createRouter', () => {
261264 } ,
262265 ) ;
263266
264- it . each ( databases . eachSupportedId ( ) ) (
267+ it . each ( supportedDatabaseIds ) (
265268 'should delete a project by id - %p' ,
266269 async databaseId => {
267270 const { client } = await createDatabase ( databaseId ) ;
@@ -297,7 +300,7 @@ describe('createRouter', () => {
297300 } ,
298301 ) ;
299302
300- it . each ( databases . eachSupportedId ( ) ) (
303+ it . each ( supportedDatabaseIds ) (
301304 'should return 404 when deleting non-existent project - %p' ,
302305 async databaseId => {
303306 const { client } = await createDatabase ( databaseId ) ;
@@ -314,7 +317,7 @@ describe('createRouter', () => {
314317 } ,
315318 ) ;
316319
317- it . each ( databases . eachSupportedId ( ) ) (
320+ it . each ( supportedDatabaseIds ) (
318321 'should allow users with admin write permission to delete any project - %p' ,
319322 async databaseId => {
320323 const { client } = await createDatabase ( databaseId ) ;
@@ -395,7 +398,7 @@ describe('createRouter', () => {
395398 } ,
396399 ) ;
397400
398- it . each ( databases . eachSupportedId ( ) ) (
401+ it . each ( supportedDatabaseIds ) (
399402 'should allow users without admin write permission to delete their own project - %p' ,
400403 async databaseId => {
401404 const { client } = await createDatabase ( databaseId ) ;
@@ -431,7 +434,7 @@ describe('createRouter', () => {
431434 } ,
432435 ) ;
433436
434- it . each ( databases . eachSupportedId ( ) ) (
437+ it . each ( supportedDatabaseIds ) (
435438 'should return 404 when deletion fails due to permission filtering - %p' ,
436439 async databaseId => {
437440 const { client } = await createDatabase ( databaseId ) ;
@@ -466,7 +469,7 @@ describe('createRouter', () => {
466469 } ,
467470 ) ;
468471
469- it . each ( databases . eachSupportedId ( ) ) (
472+ it . each ( supportedDatabaseIds ) (
470473 'should return 404 when deleting non-existent project even with admin write permission - %p' ,
471474 async databaseId => {
472475 const { client } = await createDatabase ( databaseId ) ;
0 commit comments