import { getChangedLineNumbersFromPatch } from '../parseGitPatch'; describe('parseGitPatch', () => { test('empty patch', () => { const result = getChangedLineNumbersFromPatch(''); expect(result).toEqual([]); }); test('all new markdown', () => { const result = getChangedLineNumbersFromPatch(`@@ -0,0 +1,9 @@ +# Title + +Paragraph here + +## Sub heading + +Content here. +More content. +Yes, more content.`); expect(result).toEqual([1, 3, 5, 7, 8, 9]); }); test('ignore code samples', () => { const result = getChangedLineNumbersFromPatch(`@@ -0,0 +1,11 @@ +# Title + +Paragraph here + +## Sub heading + +\`\`\`javascript +console.log("foo"); +\`\`\` + +Content here.`); expect(result).toEqual([1, 3, 5, 11]); }); test('mixed changes', () => { const result = getChangedLineNumbersFromPatch(`@@ -20,7 +20,7 @@ Maintain better code coverage with [SonarQube](https://wiki.hq.twilio.com/displa Start running game days on your team with our resources. Have a question? Drop it in [#testing-guild](https://twilio.slack.com/archives/C2Y11002Y) -[Go to Game Days»](game-day/intro.md) +[Go to Game Days»](game-days/intro.md) ## Chaos Testing `); expect(result).toEqual([23]); }); test('ignore front matter', () => { const result = getChangedLineNumbersFromPatch(`@@ -0,0 +1,12 @@ +--- +sidebar_position: 8 +--- + +# Game Day Examples + +The following is a list of resources: + +* [Game Days for Global Resource Routing Service](https://drive.google.com/drive/u/0/folders/1rzQcvLFu5ZxaqwjPGbfLdWUPulhglqo_?ths=true) +* [Game Days for Regulatory Compliance Manager](https://drive.google.com/drive/folders/1yjdIsYUVMtEp5uiiOKb1Da5KvZVB2PcV) +* [Regional Game Days for Inventory Lifecycle and Global Resource Routing Service](https://drive.google.com/drive/u/0/folders/1bJufWDDqNmW5EpAN61AQhaX6oCwyb5-p?ths=true) +* [Global Twilio Team: Game Days](https://drive.google.com/drive/u/0/folders/1w1vhqCehuf2vTyZQXDmHkDsrA7zf7Th2)`); expect(result).toEqual([5, 7, 9, 10, 11, 12]); }); });