Use a two-column FactSet for short fields and keep multi-line textarea values in separate blocks. Co-authored-by: Cursor <cursoragent@cursor.com>
42 lines
1.8 KiB
JavaScript
42 lines
1.8 KiB
JavaScript
import { describe, it } from 'node:test';
|
|
import assert from 'node:assert/strict';
|
|
import { buildRequestApproval } from '../services/approvalCards.js';
|
|
|
|
const sampleTicket = {
|
|
issue: {
|
|
key: 'REQUEST-152413',
|
|
fields: {
|
|
status: { name: 'Pending Approval' },
|
|
summary: 'Requesting full Jira access for Melissa Carr',
|
|
reporter: { displayName: 'Cj Nolan' },
|
|
customfield_10010: {
|
|
requestType: { id: '209', name: 'Application Access' },
|
|
},
|
|
priority: { value: '4 - Medium' },
|
|
created: '2026-07-28T20:33:16.000Z',
|
|
updated: '2026-07-28T20:33:32.000Z',
|
|
customfield_10346: 'Carr',
|
|
customfield_10314: 'Melissa',
|
|
customfield_10318: 'Store Ops-Technology',
|
|
customfield_10310: { value: 'Employee' },
|
|
customfield_10419: 'CarrM@ae.com',
|
|
customfield_10365: { displayName: 'Cj Nolan' },
|
|
},
|
|
},
|
|
transition: { transitionName: 'Manager Approval' },
|
|
user: { displayName: 'Automation for Jira' },
|
|
};
|
|
|
|
describe('buildRequestApproval', () => {
|
|
it('renders compact details in a FactSet', async () => {
|
|
const { card } = await buildRequestApproval(sampleTicket);
|
|
const factSet = card.body.find(block => block.type === 'FactSet');
|
|
|
|
assert.ok(factSet, 'expected a FactSet block for compact details');
|
|
assert.ok(factSet.facts.some(fact => fact.title === 'First name' && fact.value === 'Melissa'));
|
|
assert.ok(factSet.facts.some(fact => fact.title === 'Network user name' && fact.value === 'CarrM@ae.com'));
|
|
|
|
const labelBlocks = card.body.filter(block => block.type === 'TextBlock' && block.text === 'First name');
|
|
assert.equal(labelBlocks.length, 0, 'compact fields should not use per-field label blocks');
|
|
});
|
|
});
|