@@ -2,8 +2,10 @@ import assert from 'node:assert/strict';
22import fs from 'node:fs' ;
33import os from 'node:os' ;
44import path from 'node:path' ;
5+ import { spawnSync } from 'node:child_process' ;
56import { DatabaseSync } from 'node:sqlite' ;
67import test from 'node:test' ;
8+ import { fileURLToPath } from 'node:url' ;
79
810import {
911 legacyAudienceStats ,
@@ -216,3 +218,19 @@ test('reset announcement arguments are safe by default and accept a bounded cana
216218 ) ;
217219 assert . throws ( ( ) => parseArgs ( [ '--database' , '/backup.sqlite' , '--limit' , '0' ] ) ) ;
218220} ) ;
221+
222+ test ( 'reset announcement CLI runs when invoked through the production-style current symlink' , ( t ) => {
223+ const directory = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'slashmon-reset-cli-test-' ) ) ;
224+ const current = path . join ( directory , 'current' ) ;
225+ const script = fileURLToPath ( new URL ( '../scripts/notify-reset-watchers.mjs' , import . meta. url ) ) ;
226+ t . after ( ( ) => fs . rmSync ( directory , { recursive : true , force : true } ) ) ;
227+ fs . symlinkSync ( script , current ) ;
228+
229+ const result = spawnSync ( process . execPath , [ current , '--help' ] , {
230+ encoding : 'utf8' ,
231+ } ) ;
232+
233+ assert . equal ( result . status , 0 , result . stderr ) ;
234+ assert . match ( result . stdout , / ^ U s a g e : / ) ;
235+ assert . match ( result . stdout , / - - d a t a b a s e P A T H / ) ;
236+ } ) ;
0 commit comments