Skip to content

Commit 62aa414

Browse files
authored
Do not run tests on rebase (#439)
* do not run on rebase * test that question titles do not appear as headers in the lesson
1 parent 3b7ec07 commit 62aa414

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

.husky/pre-commit

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
#!/bin/sh
22

3+
# Skip tests during rebase
4+
if [ -d .git/rebase-merge ] || [ -d .git/rebase-apply ]; then
5+
exit 0
6+
fi
7+
38
echo "Checking for modified courses..."
49

510
# Get list of staged files

tests/qa.test.js

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ describe("QA Tests", () => {
4545
return targetCourses.some((term) => slug.includes(term));
4646
});
4747
console.log(
48-
`Filtering QA tests to courses matching: ${coursePaths.join(", ")} (${
49-
coursePaths.length
48+
`Filtering QA tests to courses matching: ${coursePaths.join(", ")} (${coursePaths.length
5049
})`
5150
);
5251
}
@@ -360,9 +359,9 @@ describe("QA Tests", () => {
360359
it("should be optional, mark as read or have one or more questions", () => {
361360
expect(
362361
optional ||
363-
hasReadButton ||
364-
includesSandbox ||
365-
questionPaths.length > 0
362+
hasReadButton ||
363+
includesSandbox ||
364+
questionPaths.length > 0
366365
).toBe(true);
367366
});
368367

@@ -439,6 +438,20 @@ describe("QA Tests", () => {
439438
expect(titleMatch[1].trim().length).toBeGreaterThan(0);
440439
});
441440

441+
it("should not have its title appear in the lesson content", () => {
442+
const titleMatch = asciidoc.match(/^=\s+(.+)$/m);
443+
if (titleMatch) {
444+
const title = titleMatch[1].trim();
445+
446+
// Check if the question title appears in the lesson content
447+
if (lessonAdoc.includes(`= ${title}\n`)) {
448+
throw new Error(
449+
`Question title "${title}" should not appear in the lesson content`
450+
);
451+
}
452+
}
453+
});
454+
442455
it(`should have a hint`, () => {
443456
expect(asciidoc).toContain("\n[TIP,role=hint]");
444457
});

0 commit comments

Comments
 (0)