11import { DifferV3 } from '@api7/adc-differ' ;
22import * as ADCSDK from '@api7/adc-sdk' ;
33import axios from 'axios' ;
4- import { lastValueFrom } from 'rxjs' ;
54
65import { BackendAPISIXStandalone } from '../src' ;
76import {
87 config as configCache ,
98 rawConfig as rawConfigCache ,
109} from '../src/cache' ;
1110import { server , token } from './support/constants' ;
12- import {
13- createEvent ,
14- deleteEvent ,
15- dumpConfiguration ,
16- refreshDumpCache ,
17- restartAPISIX ,
18- syncEvents ,
19- updateEvent ,
20- } from './support/utils' ;
11+ import { dumpConfiguration , restartAPISIX , syncEvents } from './support/utils' ;
2112
2213describe ( 'Cache - Single APISIX' , ( ) => {
2314 let backend : BackendAPISIXStandalone ;
@@ -43,7 +34,7 @@ describe('Cache - Single APISIX', () => {
4334 expect ( rawConfigCache ) . toBeDefined ( ) ;
4435 expect ( rawConfigCache . size ) . toEqual ( 0 ) ;
4536
46- await expect ( lastValueFrom ( backend . dump ( ) ) ) . resolves . not . toThrow ( ) ;
37+ await expect ( dumpConfiguration ( backend ) ) . resolves . not . toThrow ( ) ;
4738
4839 expect ( configCache . size ) . toEqual ( 1 ) ;
4940 expect ( rawConfigCache . size ) . toEqual ( 1 ) ;
@@ -59,7 +50,7 @@ describe('Cache - Single APISIX', () => {
5950 let apiCall = 0 ;
6051 const sub = backend . on ( 'AXIOS_DEBUG' , ( ) => apiCall ++ ) ;
6152
62- await expect ( lastValueFrom ( backend . dump ( ) ) ) . resolves . not . toThrow ( ) ;
53+ await expect ( dumpConfiguration ( backend ) ) . resolves . not . toThrow ( ) ;
6354 expect ( apiCall ) . toEqual ( 0 ) ;
6455
6556 sub . unsubscribe ( ) ;
@@ -85,7 +76,7 @@ describe('Cache - Single APISIX', () => {
8576 } as ADCSDK . Configuration ;
8677 const now = new Date ( ) ;
8778 it ( 'update config' , async ( ) => {
88- const oldConfig = await lastValueFrom ( backend . dump ( ) ) ;
79+ const oldConfig = await dumpConfiguration ( backend ) ;
8980 const events = DifferV3 . diff ( config , oldConfig ) ;
9081 expect ( events ) . toHaveLength ( 1 + 1 + 2 ) ; // service * 1 + route * 1 + consumer * 2
9182 expect (
0 commit comments