UNPKG

@kazupon/lerna-changelog

Version:

Generate a changelog for a lerna monorepo

29 lines (28 loc) 1.6 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); const find_pull_request_id_1 = __importDefault(require("./find-pull-request-id")); describe('findPullRequestId', () => { it('finds the id in a GitHub merge commit', () => { const message = 'Merge pull request #42 from Turbo87/pkg-config\n\nRead "changelog" config key from "package.json" too'; const result = find_pull_request_id_1.default(message); expect(result).toEqual('42'); }); it('finds the id in a GitHub squash-merge commit', () => { const message = 'Adjust "lint" script (#48)\n\n* bin/cli: Use "const" instead of "var"\n\n* package.json: Adjust "lint" script'; const result = find_pull_request_id_1.default(message); expect(result).toEqual('48'); }); it('finds the id in a homu merge commit', () => { const message = 'Auto merge of #7056 - fixTypos:fix_typos, r=Turbo87\n\nfix_typos\n\nThis PR is part of a campaign to fix a lot of typos on github!\nYou can see the progress on https://github.com/fixTypos/fix_typos/\n\nhttps://github.com/client9/misspell'; const result = find_pull_request_id_1.default(message); expect(result).toEqual('7056'); }); it('returns null if no id could be found', () => { const message = 'This is not a merge commit 42'; const result = find_pull_request_id_1.default(message); expect(result).toBeNull(); }); });