@@ -51,17 +51,21 @@ async function runCli(args: string[], stdinBytes?: Uint8Array): Promise<RunResul
5151 let stdout = '' ;
5252 let stderr = '' ;
5353
54- const code = await run ( args , {
55- stdout ( message : string ) {
56- stdout += message ;
57- } ,
58- stderr ( message : string ) {
59- stderr += message ;
60- } ,
61- async readStdinBytes ( ) {
62- return stdinBytes ?? new Uint8Array ( ) ;
54+ const code = await run (
55+ args ,
56+ {
57+ stdout ( message : string ) {
58+ stdout += message ;
59+ } ,
60+ stderr ( message : string ) {
61+ stderr += message ;
62+ } ,
63+ async readStdinBytes ( ) {
64+ return stdinBytes ?? new Uint8Array ( ) ;
65+ } ,
6366 } ,
64- } ) ;
67+ { stateDir : STATE_DIR } ,
68+ ) ;
6569
6670 return { code, stdout, stderr } ;
6771}
@@ -145,7 +149,6 @@ async function firstListItemAddress(args: string[]): Promise<ListItemAddress> {
145149
146150describe ( 'superdoc CLI' , ( ) => {
147151 beforeAll ( async ( ) => {
148- process . env . SUPERDOC_CLI_STATE_DIR = STATE_DIR ;
149152 await mkdir ( TEST_DIR , { recursive : true } ) ;
150153 await copyFile ( await resolveSourceDocFixture ( ) , SAMPLE_DOC ) ;
151154 await copyFile ( await resolveListDocFixture ( ) , LIST_SAMPLE_DOC ) ;
@@ -157,7 +160,6 @@ describe('superdoc CLI', () => {
157160
158161 afterAll ( async ( ) => {
159162 await rm ( TEST_DIR , { recursive : true , force : true } ) ;
160- delete process . env . SUPERDOC_CLI_STATE_DIR ;
161163 } ) ;
162164
163165 test ( 'status returns inactive when no document is open' , async ( ) => {
@@ -1172,28 +1174,26 @@ describe('superdoc CLI', () => {
11721174 expect ( closeResult . code ) . toBe ( 0 ) ;
11731175 } ) ;
11741176
1175- test ( 'lists set-type tracked mode maps to TRACK_CHANGE_COMMAND_UNAVAILABLE' , async ( ) => {
1176- const source = join ( TEST_DIR , 'lists-set-type -source.docx' ) ;
1177- const out = join ( TEST_DIR , 'lists-set-type -out.docx' ) ;
1177+ test ( 'lists detach tracked mode maps to TRACK_CHANGE_COMMAND_UNAVAILABLE' , async ( ) => {
1178+ const source = join ( TEST_DIR , 'lists-detach -source.docx' ) ;
1179+ const out = join ( TEST_DIR , 'lists-detach -out.docx' ) ;
11781180 await copyFile ( LIST_SAMPLE_DOC , source ) ;
11791181
11801182 const target = await firstListItemAddress ( [ 'lists' , 'list' , source , '--limit' , '1' ] ) ;
1181- const setTypeResult = await runCli ( [
1183+ const detachResult = await runCli ( [
11821184 'lists' ,
1183- 'set-type ' ,
1185+ 'detach ' ,
11841186 source ,
11851187 '--target-json' ,
11861188 JSON . stringify ( target ) ,
1187- '--kind' ,
1188- 'bullet' ,
11891189 '--change-mode' ,
11901190 'tracked' ,
11911191 '--out' ,
11921192 out ,
11931193 ] ) ;
11941194
1195- expect ( setTypeResult . code ) . toBe ( 1 ) ;
1196- const envelope = parseJsonOutput < ErrorEnvelope > ( setTypeResult ) ;
1195+ expect ( detachResult . code ) . toBe ( 1 ) ;
1196+ const envelope = parseJsonOutput < ErrorEnvelope > ( detachResult ) ;
11971197 expect ( envelope . error . code ) . toBe ( 'TRACK_CHANGE_COMMAND_UNAVAILABLE' ) ;
11981198 } ) ;
11991199
0 commit comments