File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,6 +51,25 @@ describe('package scripts', () => {
5151 }
5252 } ) ;
5353
54+ it ( 'lets Docker live testing use process environment credentials without a .env file' , ( ) => {
55+ const result = spawnSync ( 'node' , [
56+ '-e' ,
57+ [
58+ 'process.env.HELPSCOUT_APP_ID="env-app";' ,
59+ 'process.env.HELPSCOUT_APP_SECRET="env-secret";' ,
60+ 'const { loadEnvFile } = require("./tests/test-docker.cjs");' ,
61+ 'const env = loadEnvFile();' ,
62+ 'process.stdout.write(`${env.HELPSCOUT_APP_ID}:${env.HELPSCOUT_APP_SECRET}`);' ,
63+ ] . join ( '' ) ,
64+ ] , {
65+ cwd : process . cwd ( ) ,
66+ encoding : 'utf8' ,
67+ } ) ;
68+
69+ expect ( result . status ) . toBe ( 0 ) ;
70+ expect ( result . stdout ) . toBe ( 'env-app:env-secret' ) ;
71+ } ) ;
72+
5473 it ( 'guards sync:plugin when the target checkout has local files' , ( ) => {
5574 const tempRoot = fs . mkdtempSync ( path . join ( os . tmpdir ( ) , 'helpscout-sync-plugin-' ) ) ;
5675 const pluginDir = path . join ( tempRoot , 'helpscout-navigator' ) ;
Original file line number Diff line number Diff line change @@ -427,6 +427,25 @@ describe('PromptHandler', () => {
427427 expect ( searchParams . extra ) . toBeUndefined ( ) ;
428428 } ) ;
429429
430+ it ( 'should keep the activity timestamp example internally consistent' , async ( ) => {
431+ const request = {
432+ method : 'prompts/get' ,
433+ params : {
434+ name : 'list-inbox-activity' ,
435+ arguments : {
436+ inboxId : 'inbox-123' ,
437+ hours : 12 ,
438+ }
439+ }
440+ } ;
441+
442+ const result = await promptHandler . getPrompt ( request ) ;
443+ const promptText = result . messages [ 0 ] . content . text ;
444+
445+ expect ( promptText ) . toContain ( 'If current time is "2025-06-11T15:04:00Z" and hours is 12' ) ;
446+ expect ( promptText ) . toContain ( 'then 12 hours ago would be "2025-06-11T03:04:00Z"' ) ;
447+ } ) ;
448+
430449 it ( 'should include thread details when includeThreads is true' , async ( ) => {
431450 const request = {
432451 method : 'prompts/get' ,
Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ export class PromptHandler {
99 . join ( '\n' ) ;
1010 }
1111
12+ private exampleHoursAgo ( hours : number ) : string {
13+ const exampleNow = new Date ( '2025-06-11T15:04:00Z' ) ;
14+ return new Date ( exampleNow . getTime ( ) - hours * 60 * 60 * 1000 )
15+ . toISOString ( )
16+ . replace ( / \. \d { 3 } Z $ / , 'Z' ) ;
17+ }
18+
1219 private parsePositiveHours ( value : unknown ) : number | null {
1320 if ( typeof value !== 'number' && typeof value !== 'string' ) {
1421 return null ;
@@ -436,8 +443,8 @@ Note: The exact tag names may vary by organization. Common urgent tag variations
436443
4374442. Calculate the timestamp ${ hours } hours ago from the current time.
438445 - Subtract ${ hours } hours from the current timestamp
439- - Example: If current time is "2025-06-11T15:04:00Z" and hours is 24,
440- then ${ hours } hours ago would be "${ new Date ( new Date ( ) . getTime ( ) - hours * 60 * 60 * 1000 ) . toISOString ( ) . replace ( / \. \d { 3 } Z $ / , 'Z' ) } "
446+ - Example: If current time is "2025-06-11T15:04:00Z" and hours is ${ hours } ,
447+ then ${ hours } hours ago would be "${ this . exampleHoursAgo ( hours ) } "
441448
4424493. Search for conversations in the specified inbox using the "searchConversations" tool:
443450 \`\`\`json
Original file line number Diff line number Diff line change @@ -11,7 +11,7 @@ const MCP_RESPONSE_TIMEOUT_MS = 30_000;
1111function loadEnvFile ( ) {
1212 const envPath = path . join ( __dirname , '..' , '.env' ) ;
1313 if ( ! fs . existsSync ( envPath ) ) {
14- throw new Error ( 'Missing .env file. Copy .env.example to .env and add Help Scout OAuth credentials.' ) ;
14+ return process . env ;
1515 }
1616
1717 const env = { } ;
@@ -288,3 +288,4 @@ if (require.main === module) {
288288}
289289
290290module . exports = DockerLiveTester ;
291+ module . exports . loadEnvFile = loadEnvFile ;
You can’t perform that action at this time.
0 commit comments