File tree Expand file tree Collapse file tree 1 file changed +37
-0
lines changed
Expand file tree Collapse file tree 1 file changed +37
-0
lines changed Original file line number Diff line number Diff line change 1+ import test from "ava" ;
2+ import * as sinon from "sinon" ;
3+
4+ import * as apiClient from "../api-client" ;
5+ import { Feature , featureConfig } from "../feature-flags" ;
6+ import { mockCCR , setupTests } from "../testing-utils" ;
7+ import { initializeEnvironment , withTmpDir } from "../util" ;
8+
9+ import {
10+ getFeatureIncludingCodeQlIfRequired ,
11+ setUpFeatureFlagTests ,
12+ } from "./test-util" ;
13+
14+ setupTests ( test ) ;
15+
16+ test . beforeEach ( ( ) => {
17+ initializeEnvironment ( "1.2.3" ) ;
18+ mockCCR ( ) ;
19+ } ) ;
20+
21+ test ( "OfflineFeatures makes no API requests" , async ( t ) => {
22+ await withTmpDir ( async ( tmpDir ) => {
23+ const features = setUpFeatureFlagTests ( tmpDir ) ;
24+ t . is ( "OfflineFeatures" , features . constructor . name ) ;
25+
26+ sinon
27+ . stub ( apiClient , "getApiClient" )
28+ . throws ( new Error ( "Should not have called getApiClient" ) ) ;
29+
30+ for ( const feature of Object . values ( Feature ) ) {
31+ t . deepEqual (
32+ await getFeatureIncludingCodeQlIfRequired ( features , feature ) ,
33+ featureConfig [ feature ] . defaultValue ,
34+ ) ;
35+ }
36+ } ) ;
37+ } ) ;
You can’t perform that action at this time.
0 commit comments