@@ -14,9 +14,7 @@ mock.module("child_process", () => ({
1414} ) )
1515
1616// Import after mocking
17- const { execDbtShow, execDbtCompile, execDbtCompileInline, execDbtLs } = await import (
18- "../src/dbt-cli"
19- )
17+ const { execDbtShow, execDbtCompile, execDbtCompileInline, execDbtLs } = await import ( "../src/dbt-cli" )
2018
2119// ---------------------------------------------------------------------------
2220// execDbtShow
@@ -46,9 +44,7 @@ describe("execDbtShow", () => {
4644 } )
4745
4846 test ( "Tier 1: parses data.rows (alternative format)" , async ( ) => {
49- const jsonLines = [
50- JSON . stringify ( { data : { rows : [ { name : "Alice" } , { name : "Bob" } ] } } ) ,
51- ] . join ( "\n" )
47+ const jsonLines = [ JSON . stringify ( { data : { rows : [ { name : "Alice" } , { name : "Bob" } ] } } ) ] . join ( "\n" )
5248
5349 mockExecFile . mockImplementation ( ( _cmd : string , _args : string [ ] , _opts : any , cb : Function ) => {
5450 cb ( null , jsonLines , "" )
@@ -60,9 +56,7 @@ describe("execDbtShow", () => {
6056 } )
6157
6258 test ( "Tier 1: parses result.preview (hypothetical future format)" , async ( ) => {
63- const jsonLines = [
64- JSON . stringify ( { result : { preview : [ { id : 42 } ] , sql : "SELECT 42" } } ) ,
65- ] . join ( "\n" )
59+ const jsonLines = [ JSON . stringify ( { result : { preview : [ { id : 42 } ] , sql : "SELECT 42" } } ) ] . join ( "\n" )
6660
6761 mockExecFile . mockImplementation ( ( _cmd : string , _args : string [ ] , _opts : any , cb : Function ) => {
6862 cb ( null , jsonLines , "" )
@@ -136,16 +130,7 @@ describe("execDbtShow", () => {
136130 cb ( null , JSON . stringify ( { info : { msg : "done" } } ) , "" )
137131 } else {
138132 // Plain text ASCII table
139- cb (
140- null ,
141- [
142- "| id | name |" ,
143- "| -- | ----- |" ,
144- "| 1 | Alice |" ,
145- "| 2 | Bob |" ,
146- ] . join ( "\n" ) ,
147- "" ,
148- )
133+ cb ( null , [ "| id | name |" , "| -- | ----- |" , "| 1 | Alice |" , "| 2 | Bob |" ] . join ( "\n" ) , "" )
149134 }
150135 } )
151136
@@ -189,9 +174,7 @@ describe("execDbtCompile", () => {
189174 } )
190175
191176 test ( "Tier 1: parses data.compiled_code (newer dbt)" , async ( ) => {
192- const jsonLines = [
193- JSON . stringify ( { data : { compiled_code : "SELECT * FROM stg_orders" } } ) ,
194- ] . join ( "\n" )
177+ const jsonLines = [ JSON . stringify ( { data : { compiled_code : "SELECT * FROM stg_orders" } } ) ] . join ( "\n" )
195178
196179 mockExecFile . mockImplementation ( ( _cmd : string , _args : string [ ] , _opts : any , cb : Function ) => {
197180 cb ( null , jsonLines , "" )
@@ -202,9 +185,7 @@ describe("execDbtCompile", () => {
202185 } )
203186
204187 test ( "Tier 1: parses result.node.compiled_code" , async ( ) => {
205- const jsonLines = [
206- JSON . stringify ( { result : { node : { compiled_code : "SELECT 1" } } } ) ,
207- ] . join ( "\n" )
188+ const jsonLines = [ JSON . stringify ( { result : { node : { compiled_code : "SELECT 1" } } } ) ] . join ( "\n" )
208189
209190 mockExecFile . mockImplementation ( ( _cmd : string , _args : string [ ] , _opts : any , cb : Function ) => {
210191 cb ( null , jsonLines , "" )
@@ -215,9 +196,7 @@ describe("execDbtCompile", () => {
215196 } )
216197
217198 test ( "Tier 1: parses data.compiled_sql" , async ( ) => {
218- const jsonLines = [
219- JSON . stringify ( { data : { compiled_sql : "SELECT 1 FROM foo" } } ) ,
220- ] . join ( "\n" )
199+ const jsonLines = [ JSON . stringify ( { data : { compiled_sql : "SELECT 1 FROM foo" } } ) ] . join ( "\n" )
221200
222201 mockExecFile . mockImplementation ( ( _cmd : string , _args : string [ ] , _opts : any , cb : Function ) => {
223202 cb ( null , jsonLines , "" )
@@ -273,9 +252,7 @@ describe("execDbtCompileInline", () => {
273252 } )
274253
275254 test ( "compiles inline SQL" , async ( ) => {
276- const jsonLines = [
277- JSON . stringify ( { data : { compiled : "SELECT id, name FROM raw.customers" } } ) ,
278- ] . join ( "\n" )
255+ const jsonLines = [ JSON . stringify ( { data : { compiled : "SELECT id, name FROM raw.customers" } } ) ] . join ( "\n" )
279256
280257 mockExecFile . mockImplementation ( ( _cmd : string , _args : string [ ] , _opts : any , cb : Function ) => {
281258 cb ( null , jsonLines , "" )
@@ -339,11 +316,7 @@ describe("execDbtLs", () => {
339316 cb ( new Error ( "--output json not supported" ) , "" , "" )
340317 } else {
341318 // Plain text: one unique_id per line
342- cb (
343- null ,
344- "model.jaffle.stg_orders\nmodel.jaffle.stg_payments\nmodel.jaffle.orders\n" ,
345- "" ,
346- )
319+ cb ( null , "model.jaffle.stg_orders\nmodel.jaffle.stg_payments\nmodel.jaffle.orders\n" , "" )
347320 }
348321 } )
349322
0 commit comments