@@ -2,12 +2,17 @@ import test from "ava";
22import * as sinon from "sinon" ;
33
44import * as apiClient from "../api-client" ;
5- import { Feature , featureConfig } from "../feature-flags" ;
6- import { mockCCR , setupTests } from "../testing-utils" ;
5+ import {
6+ checkExpectedLogMessages ,
7+ getRecordingLogger ,
8+ LoggedMessage ,
9+ mockCCR ,
10+ setupTests ,
11+ } from "../testing-utils" ;
712import { initializeEnvironment , withTmpDir } from "../util" ;
813
914import {
10- getFeatureIncludingCodeQlIfRequired ,
15+ assertAllFeaturesHaveDefaultValues ,
1116 setUpFeatureFlagTests ,
1217} from "./testing-util" ;
1318
@@ -20,18 +25,18 @@ test.beforeEach(() => {
2025
2126test ( "OfflineFeatures makes no API requests" , async ( t ) => {
2227 await withTmpDir ( async ( tmpDir ) => {
23- const features = setUpFeatureFlagTests ( tmpDir ) ;
28+ const loggedMessages : LoggedMessage [ ] = [ ] ;
29+ const logger = getRecordingLogger ( loggedMessages ) ;
30+ const features = setUpFeatureFlagTests ( tmpDir , logger ) ;
2431 t . is ( "OfflineFeatures" , features . constructor . name ) ;
2532
2633 sinon
2734 . stub ( apiClient , "getApiClient" )
2835 . throws ( new Error ( "Should not have called getApiClient" ) ) ;
2936
30- for ( const feature of Object . values ( Feature ) ) {
31- t . deepEqual (
32- await getFeatureIncludingCodeQlIfRequired ( features , feature ) ,
33- featureConfig [ feature ] . defaultValue ,
34- ) ;
35- }
37+ await assertAllFeaturesHaveDefaultValues ( t , features ) ;
38+ checkExpectedLogMessages ( t , loggedMessages , [
39+ "Querying feature flags is not currently supported in Copilot Code Review. Using offline data for all features." ,
40+ ] ) ;
3641 } ) ;
3742} ) ;
0 commit comments