mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 00:55:20 +01:00
2c76673f70
## About The Pull Request - Update Biome to 2.4.16 - Update prettier to 3.8.3 - Apply biome linting rules to a bunch of files - Convert some files from common-js to es module ## Changelog N/A
86 lines
2.0 KiB
JavaScript
86 lines
2.0 KiB
JavaScript
import { strict as assert } from 'node:assert';
|
|
import { parseChangelog } from './changelogParser.js';
|
|
|
|
// Basic test
|
|
const basicChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl: DenverCoder9
|
|
add: Adds new stuff
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(basicChangelog.author, 'DenverCoder9');
|
|
assert.equal(basicChangelog.changes.length, 1);
|
|
assert.equal(basicChangelog.changes[0].type.changelogKey, 'rscadd');
|
|
assert.equal(basicChangelog.changes[0].description, 'Adds new stuff');
|
|
|
|
// Case-insensitivity test
|
|
const mixedCaseChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl: DenverCoder9
|
|
Add: Adds new stuff
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(mixedCaseChangelog.author, 'DenverCoder9');
|
|
assert.equal(mixedCaseChangelog.changes.length, 1);
|
|
assert.equal(mixedCaseChangelog.changes[0].type.changelogKey, 'rscadd');
|
|
assert.equal(mixedCaseChangelog.changes[0].description, 'Adds new stuff');
|
|
|
|
// Multi-line test
|
|
const multiLineChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl:
|
|
add: Adds new stuff
|
|
to the game
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(multiLineChangelog.author, undefined);
|
|
assert.equal(multiLineChangelog.changes.length, 1);
|
|
assert.equal(multiLineChangelog.changes[0].type.changelogKey, 'rscadd');
|
|
assert.equal(
|
|
multiLineChangelog.changes[0].description,
|
|
'Adds new stuff\nto the game',
|
|
);
|
|
|
|
// Placeholders
|
|
const placeholderChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl:
|
|
add: Added new mechanics or gameplay changes
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(placeholderChangelog.changes.length, 0);
|
|
|
|
// No changelog
|
|
const noChangelog = parseChangelog(`
|
|
My cool PR!
|
|
`);
|
|
|
|
assert.equal(noChangelog, undefined);
|
|
|
|
// No /:cl:
|
|
|
|
const noCloseChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl:
|
|
add: Adds new stuff
|
|
`);
|
|
|
|
assert.equal(noCloseChangelog.changes.length, 1);
|
|
assert.equal(noCloseChangelog.changes[0].type.changelogKey, 'rscadd');
|
|
assert.equal(noCloseChangelog.changes[0].description, 'Adds new stuff');
|
|
|
|
// :cl: with arbitrary text
|
|
|
|
const arbitraryTextChangelog = parseChangelog(`
|
|
My cool PR!
|
|
:cl:
|
|
Adds new stuff
|
|
/:cl:
|
|
`);
|
|
|
|
assert.equal(arbitraryTextChangelog.changes.length, 0);
|