Skip to content

Commit

Permalink
✅ add additional example to test assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
ctcpip committed Oct 31, 2023
1 parent 7fdbee1 commit ce92419
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 8 deletions.
16 changes: 8 additions & 8 deletions scripts/bad-linebreaks-test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@ const afterMD = './scripts/test-samples/bad-linebreaks-sample-after.md';
const beforeMD = './scripts/test-samples/bad-linebreaks-sample-before.md';

// verify hash values to detect file tampering
const knownAfterHash = '5f29c1fb4abd747c2dd801e12c600ee3';
const knownBeforeHash = '406e900af5cd9af66abbe5b3ab6bcf3e';
const afterHash = await getHashSlingingSlasher(afterMD);
const knownBeforeHash = '135c042cd49cb6b21ebadc83b0f247ba';
const knownAfterHash = 'cf287b7594663879a10e866b47c76fef';
const beforeHash = await getHashSlingingSlasher(beforeMD);
assert.strictEqual(afterHash, knownAfterHash);
const afterHash = await getHashSlingingSlasher(afterMD);
assert.strictEqual(beforeHash, knownBeforeHash);
assert.strictEqual(afterHash, knownAfterHash);

let fixed, totalMatches;

({ fixed, totalMatches } = findBadStuff(beforeMD, true));
assert.strictEqual(totalMatches.badLinebreaks, 12);
assert.strictEqual(totalMatches.extraWhitespace, 114);
assert.strictEqual(totalMatches.badLinebreaks, 20);
assert.strictEqual(totalMatches.extraWhitespace, 124);
assert.strictEqual(fixed, fs.readFileSync(afterMD, 'utf8').toString());

({ fixed, totalMatches } = findBadStuff(afterMD, true));
Expand All @@ -27,8 +27,8 @@ assert.strictEqual(totalMatches.extraWhitespace, 0);
assert.strictEqual(fixed, fs.readFileSync(afterMD, 'utf8').toString());

({ fixed, totalMatches } = findBadStuff(beforeMD));
assert.strictEqual(totalMatches.badLinebreaks, 12);
assert.strictEqual(totalMatches.extraWhitespace, 114);
assert.strictEqual(totalMatches.badLinebreaks, 20);
assert.strictEqual(totalMatches.extraWhitespace, 124);

function getHashSlingingSlasher(file) { // 💀
return new Promise((res, rej) => {
Expand Down
2 changes: 2 additions & 0 deletions scripts/test-samples/bad-linebreaks-sample-after.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ let biscuits = "delicious";
* one more
+ time

All right, what about the current agenda? Are there any objections to the current agenda? And I will say because I’m working on a laptop, I cannot see the element room right now. If any of the other chairs do see anything, please just interrupt. I’m going to take silence as approval. I will say with today’s current agenda, or this week’s current agenda, it is packed. It is oversubscribed. You’ll see that we have many really good items in the overflow slot at the moment. We’re going to work you know, we’re going to do our best to claw some back. Maybe some people will consider deprioritizing items. I know I’ve already heard some some candidates there that we may do. But the main thing is we need to really work hard to keep -- to do food time keeping and stick to our time boxes.

## story time!

True! nervous, very, very dreadfully nervous I had been and am; but why will you say that I am mad? The disease had sharpened my senses, not destroyed, not dulled them. Above all was the sense of hearing acute. I heard all things in the heaven and in the earth. I heard many things in hell. How then am I mad? Hearken! and observe how healthily, how calmly I can tell you the whole story.
Expand Down
10 changes: 10 additions & 0 deletions scripts/test-samples/bad-linebreaks-sample-before.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ let biscuits = "delicious";
* one more
+ time

All right, what about the current agenda? Are there any objections to the current agenda? And
I will say because I’m working on a laptop, I cannot see the element room right now. If any of
the other chairs do see anything, please just interrupt. I’m going to take silence as
approval. I will say with today’s current agenda, or this week’s current agenda, it is packed.
It is oversubscribed. You’ll see that we have many really good items in the overflow slot at
the moment. We’re going to work you know, we’re going to do our best to claw some back.
Maybe some people will consider deprioritizing items. I know I’ve already heard some some
candidates there that we may do. But the main thing is we need to really work hard to keep --
to do food time keeping and stick to our time boxes.

## story time!

True! nervous, very, very dreadfully nervous I had been and am; but why will you say that I am mad? The disease had sharpened my senses, not destroyed,
Expand Down

0 comments on commit ce92419

Please sign in to comment.