Wrap enriched and skipped ticket keys in markdown links using JIRA_BASE_URL so keys are clickable in the hourly poller room summary. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.4 KiB
JavaScript
51 lines
1.4 KiB
JavaScript
// tests/jiraPoller.formatSummary.test.js
|
|
|
|
import test from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
|
|
import {
|
|
formatEnrichedTicketLine,
|
|
formatSkippedTicketRef,
|
|
} from '../services/jiraPoller/formatSummary.js';
|
|
|
|
const ORIGINAL_BASE = process.env.JIRA_BASE_URL;
|
|
|
|
test.after(() => {
|
|
if (ORIGINAL_BASE === undefined) {
|
|
delete process.env.JIRA_BASE_URL;
|
|
} else {
|
|
process.env.JIRA_BASE_URL = ORIGINAL_BASE;
|
|
}
|
|
});
|
|
|
|
test('formatEnrichedTicketLine includes clickable Jira markdown link', () => {
|
|
process.env.JIRA_BASE_URL = 'https://aeo.atlassian.net';
|
|
|
|
const line = formatEnrichedTicketLine({
|
|
key: 'AV-4821',
|
|
summary: 'Store 0782 phone static on AA',
|
|
storeNum: '0782',
|
|
kind: 'phone',
|
|
reason: 'Communication Services symptom — call quality',
|
|
components: [{ name: 'Communication Services' }],
|
|
});
|
|
|
|
assert.match(line, /\[AV-4821\]\(https:\/\/aeo\.atlassian\.net\/browse\/AV-4821\)/);
|
|
assert.match(line, /\[store 0782\]/);
|
|
assert.match(line, /_AI: Communication Services symptom — call quality_/);
|
|
assert.match(line, /^• ☎️ /);
|
|
});
|
|
|
|
test('formatSkippedTicketRef includes clickable Jira markdown link', () => {
|
|
process.env.JIRA_BASE_URL = 'https://aeo.atlassian.net';
|
|
|
|
const ref = formatSkippedTicketRef({
|
|
key: 'AV-9999',
|
|
reason: 'no store number',
|
|
});
|
|
|
|
assert.equal(
|
|
ref,
|
|
'[AV-9999](https://aeo.atlassian.net/browse/AV-9999) (no store number)',
|
|
);
|
|
});
|