@@ -5,7 +5,6 @@ import { expect } from "chai";
5
5
import * as sdk from "./sdk" ;
6
6
import { DataConnectEmulator } from "../../../emulator/dataconnectEmulator" ;
7
7
import { Config } from "../../../config" ;
8
- import { FIXTURE_DIR } from "../../../test/fixtures/config-imports" ;
9
8
10
9
const CONNECTOR_YAML_CONTENTS = "connectorId: blah" ;
11
10
@@ -18,10 +17,14 @@ describe("init dataconnect:sdk", () => {
18
17
const sandbox = sinon . createSandbox ( ) ;
19
18
let generateStub : sinon . SinonStub ;
20
19
let fsStub : sinon . SinonStub ;
20
+ let emptyConfig : Config ;
21
+ let askProjectWriteFileStub : sinon . SinonStub ;
21
22
22
23
beforeEach ( ( ) => {
23
24
fsStub = sandbox . stub ( fs , "writeFileSync" ) ;
24
25
generateStub = sandbox . stub ( DataConnectEmulator , "generate" ) ;
26
+ emptyConfig = new Config ( { } , { projectDir : process . cwd ( ) } ) ;
27
+ askProjectWriteFileStub = sandbox . stub ( emptyConfig , "askWriteProjectFile" ) ;
25
28
} ) ;
26
29
27
30
afterEach ( ( ) => {
@@ -44,14 +47,11 @@ describe("init dataconnect:sdk", () => {
44
47
it ( c . desc , async ( ) => {
45
48
generateStub . resolves ( ) ;
46
49
fsStub . returns ( { } ) ;
47
- await sdk . actuate ( c . sdkInfo , new Config ( { } , { cwd : FIXTURE_DIR } ) , true ) ;
50
+
51
+ await sdk . actuate ( c . sdkInfo , emptyConfig ) ;
48
52
expect ( generateStub . called ) . to . equal ( c . shouldGenerate ) ;
49
- expect ( fsStub . args ) . to . deep . equal ( [
50
- [
51
- `${ process . cwd ( ) } /dataconnect/connector/connector.yaml` ,
52
- CONNECTOR_YAML_CONTENTS ,
53
- "utf8" ,
54
- ] ,
53
+ expect ( askProjectWriteFileStub . args ) . to . deep . equal ( [
54
+ [ "dataconnect/connector/connector.yaml" , CONNECTOR_YAML_CONTENTS ] ,
55
55
] ) ;
56
56
} ) ;
57
57
}
0 commit comments