@jrpool/kilotest 50.0.0 → 52.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -14,6 +14,12 @@ import path from 'node:path';
14
14
 
15
15
  const testDir = path.join(import.meta.dirname, '../../test/fixtures/comments');
16
16
  process.env.TUTORIAL_AI_COMMENTS_PATH = path.join(testDir, 'tutorialAI.json');
17
+ // Blank the alert configuration unconditionally, before index.ts (whose handleComment
18
+ // calls sendAlert for a new comment) is ever imported below, so this file sends no real
19
+ // alert emails even when run directly rather than via `npm test`.
20
+ for (const key of ['MANAGER_EMAIL', 'ALERT_API_HOST', 'ALERT_API_PATH', 'ALERT_API_KEY', 'ALERT_FROM']) {
21
+ process.env[key] = '';
22
+ }
17
23
 
18
24
  import {answer, handleComment} from './index.ts';
19
25
 
@@ -71,7 +77,7 @@ test('handleComment returns an error for a comment longer than 1000 characters',
71
77
  assert.equal(result.message, 'Your comment was longer than 1000 characters');
72
78
  });
73
79
 
74
- test('handleComment returns an error for a comment repeating one submitted within the last 1000 seconds', {timeout: 500}, async () => {
80
+ test('handleComment returns an error for a comment identical to one already submitted', {timeout: 500}, async () => {
75
81
  await fs.writeFile(getCommentsPath(), '[]\n');
76
82
  const content = 'This is a duplicate comment.';
77
83
  const firstResult = await handleComment(content);
@@ -80,7 +86,7 @@ test('handleComment returns an error for a comment repeating one submitted withi
80
86
  assert.equal(secondResult.status, 'error');
81
87
  assert.equal(
82
88
  secondResult.message,
83
- 'Your comment repeats a recently submitted one, but you are welcome to submit a different comment'
89
+ 'Your comment is identical to one already submitted, but you are welcome to submit a different comment'
84
90
  );
85
91
  });
86
92
 
@@ -91,7 +97,7 @@ test('handleComment saves a sanitized comment and returns ok', {timeout: 500}, a
91
97
  const comments = JSON.parse(await fs.readFile(getCommentsPath(), 'utf8'));
92
98
  assert.equal(comments.length, 1);
93
99
  assert.equal(comments[0].content, 'This is a test comment.');
94
- assert.ok(comments[0].dateTime);
100
+ assert.ok(comments[0].timeStamp);
95
101
  });
96
102
 
97
103
  test('handleComment strips HTML tags and control characters', {timeout: 500}, async () => {
@@ -14,6 +14,12 @@ import path from 'node:path';
14
14
 
15
15
  const testDir = path.join(import.meta.dirname, '../../test/fixtures/comments');
16
16
  process.env.TUTORIAL_WEB_COMMENTS_PATH = path.join(testDir, 'tutorialWeb.json');
17
+ // Blank the alert configuration unconditionally, before index.ts (whose handleComment
18
+ // calls sendAlert for a new comment) is ever imported below, so this file sends no real
19
+ // alert emails even when run directly rather than via `npm test`.
20
+ for (const key of ['MANAGER_EMAIL', 'ALERT_API_HOST', 'ALERT_API_PATH', 'ALERT_API_KEY', 'ALERT_FROM']) {
21
+ process.env[key] = '';
22
+ }
17
23
 
18
24
  import {answer, handleComment} from './index.ts';
19
25
 
@@ -73,7 +79,7 @@ test('handleComment returns an error for a comment longer than 1000 characters',
73
79
  assert.equal(result.message, 'Your comment was longer than 1000 characters');
74
80
  });
75
81
 
76
- test('handleComment returns an error for a comment repeating one submitted within the last 1000 seconds', {timeout: 500}, async () => {
82
+ test('handleComment returns an error for a comment identical to one already submitted', {timeout: 500}, async () => {
77
83
  await fs.writeFile(getCommentsPath(), '[]\n');
78
84
  const content = 'This is a duplicate comment.';
79
85
  const firstResult = await handleComment(content);
@@ -82,7 +88,7 @@ test('handleComment returns an error for a comment repeating one submitted withi
82
88
  assert.equal(secondResult.status, 'error');
83
89
  assert.equal(
84
90
  secondResult.message,
85
- 'Your comment repeats a recently submitted one, but you are welcome to submit a different comment'
91
+ 'Your comment is identical to one already submitted, but you are welcome to submit a different comment'
86
92
  );
87
93
  });
88
94
 
@@ -1 +0,0 @@
1
- {"sessionId":"f44e6b44-375e-4007-879a-19e4e5ed34a0","pid":90042,"procStart":"Sun Sep 20 03:19:03 2026","acquiredAt":1789874948676}