mirror of
https://github.com/SethCohen/github-releases-to-discord
synced 2026-09-14 20:13:23 +00:00
feat: add manual dispatch support for GitHub Actions to test Discord webhook integration with optional release inputs. resolves #52
This commit is contained in:
+30
-1
@@ -7,7 +7,8 @@ import {
|
||||
reduceHeadings,
|
||||
convertLinksToMarkdown,
|
||||
limitString,
|
||||
formatDescription
|
||||
formatDescription,
|
||||
resolveReleaseContext
|
||||
} from '../index.js';
|
||||
import { jest } from '@jest/globals';
|
||||
|
||||
@@ -94,6 +95,34 @@ describe('index.js utility functions', () => {
|
||||
expect(convertLinksToMarkdown(input)).toBe('[already](https://github.com/owner/repo/pull/1) and [PR #2](https://github.com/owner/repo/pull/2)');
|
||||
});
|
||||
|
||||
describe('resolveReleaseContext', () => {
|
||||
test('uses release payload when present', () => {
|
||||
const release = {
|
||||
name: 'v1.2.3',
|
||||
body: 'Release notes',
|
||||
html_url: 'https://example.com/releases/v1.2.3'
|
||||
};
|
||||
|
||||
expect(resolveReleaseContext(release, {
|
||||
name: 'ignored',
|
||||
body: 'ignored',
|
||||
html_url: 'https://example.com/ignored'
|
||||
})).toEqual(release);
|
||||
});
|
||||
|
||||
test('falls back to manual inputs when release payload is missing', () => {
|
||||
expect(resolveReleaseContext(null, {
|
||||
name: 'manual release',
|
||||
body: 'manual body',
|
||||
html_url: 'https://example.com/manual'
|
||||
})).toEqual({
|
||||
name: 'manual release',
|
||||
body: 'manual body',
|
||||
html_url: 'https://example.com/manual'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('limitString', () => {
|
||||
test('returns string unchanged if under maxLength', () => {
|
||||
expect(limitString('short', 10)).toBe('short');
|
||||
|
||||
Reference in New Issue
Block a user