|
1 |
| -const { getFilesNotOwnedByCodeOwner, findCodeOwnersForChangedFiles, githubLoginIsInCodeowners } = require("."); |
| 1 | +const { getFilesNotOwnedByCodeOwner, findCodeOwnersForChangedFiles, githubLoginIsInCodeowners, hasValidLgtmSubstring } = require("."); |
2 | 2 |
|
3 | 3 | test("determine who owns a set of files", () => {
|
4 | 4 | const noFiles = findCodeOwnersForChangedFiles(["root-codeowners/one.two.js"], "./test-code-owners-repo");
|
@@ -53,3 +53,30 @@ describe(githubLoginIsInCodeowners, () => {
|
53 | 53 | expect(noOrt).toEqual(false);
|
54 | 54 | });
|
55 | 55 | })
|
| 56 | + |
| 57 | +describe(hasValidLgtmSubstring, () => { |
| 58 | + test("allows lgtm", () => { |
| 59 | + const isValidSubstring = hasValidLgtmSubstring("this lgtm!"); |
| 60 | + expect(isValidSubstring).toEqual(true); |
| 61 | + }); |
| 62 | + test("denies lgtm but", () => { |
| 63 | + const isValidSubstring = hasValidLgtmSubstring("this lgtm but"); |
| 64 | + expect(isValidSubstring).toEqual(false); |
| 65 | + }); |
| 66 | + test("denies lgtm but", () => { |
| 67 | + const isValidSubstring = hasValidLgtmSubstring("this lgtm, but"); |
| 68 | + expect(isValidSubstring).toEqual(false); |
| 69 | + }); |
| 70 | + test("denies lgtm in double quotes", () => { |
| 71 | + const isValidSubstring = hasValidLgtmSubstring("\"lgtm\""); |
| 72 | + expect(isValidSubstring).toEqual(false); |
| 73 | + }); |
| 74 | + test("denies lgtm in single quotes", () => { |
| 75 | + const isValidSubstring = hasValidLgtmSubstring("'lgtm"); |
| 76 | + expect(isValidSubstring).toEqual(false); |
| 77 | + }); |
| 78 | + test("denies lgtm in inline code blocks", () => { |
| 79 | + const isValidSubstring = hasValidLgtmSubstring("lgtm`"); |
| 80 | + expect(isValidSubstring).toEqual(false); |
| 81 | + }); |
| 82 | +}) |
0 commit comments