11import Chance = require( 'chance' )
2- import { Uninitialized } from '@wix-velo/test-commons' ;
2+ import { Uninitialized } from '@wix-velo/test-commons'
33import { authOwner } from '@wix-velo/external-db-testkit'
44import { initApp , teardownApp , dbTeardown , setupDb , currentDbImplementationName } from '../resources/e2e_resources'
55import * as schema from '../drivers/schema_api_rest_test_support'
@@ -16,29 +16,29 @@ const axiosServer = axios.create({
1616
1717
1818describe ( `Velo External DB Index API: ${ currentDbImplementationName ( ) } ` , ( ) => {
19- beforeAll ( async ( ) => {
19+ beforeAll ( async ( ) => {
2020 await setupDb ( )
2121 await initApp ( )
2222 } )
2323
24- afterAll ( async ( ) => {
24+ afterAll ( async ( ) => {
2525 await dbTeardown ( )
2626 } , 20000 )
2727
28- test ( 'list' , async ( ) => {
28+ test ( 'list' , async ( ) => {
2929 await schema . givenCollection ( ctx . collectionName , [ ctx . column ] , authOwner )
3030
31- expect ( index . retrieveIndexesFor ( ctx . collectionName ) ) . resolves . toEqual ( matchers . listIndexResponseWithDefaultIndex ( ) )
31+ await expect ( index . retrieveIndexesFor ( ctx . collectionName , authOwner ) ) . resolves . toEqual ( matchers . listIndexResponseWithDefaultIndex ( ) )
3232 } )
3333
34- test ( 'list with multiple indexes' , async ( ) => {
34+ test ( 'list with multiple indexes' , async ( ) => {
3535 await schema . givenCollection ( ctx . collectionName , [ ctx . column ] , authOwner )
3636 await index . givenIndexes ( ctx . collectionName , [ ctx . index ] , authOwner )
3737
38- await expect ( index . retrieveIndexesFor ( ctx . collectionName ) ) . resolves . toEqual ( matchers . listIndexResponseWith ( [ ctx . index ] ) )
38+ await expect ( index . retrieveIndexesFor ( ctx . collectionName , authOwner ) ) . resolves . toEqual ( matchers . listIndexResponseWith ( [ ctx . index ] ) )
3939 } )
4040
41- test ( 'create' , async ( ) => {
41+ test ( 'create' , async ( ) => {
4242 await schema . givenCollection ( ctx . collectionName , [ ctx . column ] , authOwner )
4343
4444 // in-progress
@@ -48,12 +48,12 @@ describe(`Velo External DB Index API: ${currentDbImplementationName()}`, () => {
4848 } , authOwner ) ) . resolves . toEqual ( matchers . createIndexResponseWith ( ctx . index ) )
4949
5050 // active
51- await eventually ( async ( ) =>
52- await expect ( index . retrieveIndexesFor ( ctx . collectionName ) ) . resolves . toEqual ( matchers . listIndexResponseWith ( [ ctx . index ] ) )
51+ await eventually ( async ( ) =>
52+ await expect ( index . retrieveIndexesFor ( ctx . collectionName , authOwner ) ) . resolves . toEqual ( matchers . listIndexResponseWith ( [ ctx . index ] ) )
5353 )
5454 } )
5555
56- test ( 'create with existing index' , async ( ) => {
56+ test ( 'create with existing index' , async ( ) => {
5757 await schema . givenCollection ( ctx . collectionName , [ ctx . column ] , authOwner )
5858 await index . givenIndexes ( ctx . collectionName , [ ctx . index ] , authOwner )
5959
@@ -63,7 +63,7 @@ describe(`Velo External DB Index API: ${currentDbImplementationName()}`, () => {
6363 } , authOwner ) ) . rejects . toThrow ( )
6464 } )
6565
66- test ( 'remove' , async ( ) => {
66+ test ( 'remove' , async ( ) => {
6767 await schema . givenCollection ( ctx . collectionName , [ ctx . column ] , authOwner )
6868 await index . givenIndexes ( ctx . collectionName , [ ctx . index ] , authOwner )
6969
@@ -72,25 +72,25 @@ describe(`Velo External DB Index API: ${currentDbImplementationName()}`, () => {
7272 indexName : ctx . index . name
7373 } , authOwner ) ) . resolves . toEqual ( matchers . removeIndexResponse ( ) ) . catch ( )
7474
75- await expect ( index . retrieveIndexesFor ( ctx . collectionName ) ) . resolves . not . toEqual ( matchers . listIndexResponseWith ( [ ctx . index ] ) )
75+ await expect ( index . retrieveIndexesFor ( ctx . collectionName , authOwner ) ) . resolves . not . toEqual ( matchers . listIndexResponseWith ( [ ctx . index ] ) )
7676 } )
7777
7878
79- test ( 'get failed indexes' , async ( ) => {
79+ test ( 'get failed indexes' , async ( ) => {
8080 await schema . givenCollection ( ctx . collectionName , [ ctx . column ] , authOwner )
8181
8282 await axiosServer . post ( '/indexes/create' , {
8383 dataCollectionId : ctx . collectionName ,
8484 index : ctx . invalidIndex
85- } , authOwner ) . catch ( e => { } )
85+ } , authOwner ) . catch ( _e => { } )
8686
8787
88- await eventually ( async ( ) =>
89- await expect ( index . retrieveIndexesFor ( ctx . collectionName ) ) . resolves . toEqual ( matchers . listIndexResponseWithFailedIndex ( ctx . invalidIndex ) )
88+ await eventually ( async ( ) =>
89+ await expect ( index . retrieveIndexesFor ( ctx . collectionName , authOwner ) ) . resolves . toEqual ( matchers . listIndexResponseWithFailedIndex ( ctx . invalidIndex ) )
9090 )
9191 } )
9292
93- afterAll ( async ( ) => {
93+ afterAll ( async ( ) => {
9494 await teardownApp ( )
9595 } )
9696
@@ -107,4 +107,4 @@ describe(`Velo External DB Index API: ${currentDbImplementationName()}`, () => {
107107 ctx . index = gen . spiIndexFor ( ctx . collectionName , [ ctx . column . name ] )
108108 ctx . invalidIndex = gen . spiIndexFor ( ctx . collectionName , [ 'wrongColumn' ] )
109109 } )
110- } ) ;
110+ } )
0 commit comments