This repository has been archived by the owner on Feb 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This implements a few features: - eip authors can also make changes to the assets file which will allow any changes so long as the eip passes; i.e. I can do whatever I want to assets/eip-2/.. if I (at the same time) make changes to EIPs/eip-2.md and that is eligible for auto-merge. - if an editor approves then any non eip file will pass I also made a few cleanups - better error handling - cleaner code - more tests - conitnuing transition to class based approach (I'm converting old style to new style whenever I make changes to that file
- Loading branch information
1 parent
cf260ea
commit b9e9330
Showing
19 changed files
with
1,457 additions
and
112 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
src/modules/assertions/__tests__/assert_valid_filename.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import { initGeneralTestEnv, mockGithubContext } from "src/tests/testutils"; | ||
import { EVENTS } from "src/domain"; | ||
import { FileFactory } from "src/tests/factories/fileFactory"; | ||
import { AssertValidFilename } from "#/assertions/assert_valid_filename"; | ||
|
||
describe("require_file_preexisting", () => { | ||
mockGithubContext({ | ||
payload: { pull_request: { number: 1 } }, | ||
repo: { repo: "repo", owner: "owner" }, | ||
eventName: EVENTS.pullRequestTarget | ||
}); | ||
|
||
initGeneralTestEnv(); | ||
|
||
const requireFilenameEipNum = jest.fn(); | ||
const _AssertValidFilename = new AssertValidFilename( | ||
{requireFilenameEipNum} | ||
); | ||
|
||
beforeEach(async () => { | ||
requireFilenameEipNum.mockReturnValue(Promise.resolve(1)); | ||
}); | ||
|
||
it("should return undefined if filename is valid", async () => { | ||
const file = FileFactory(); | ||
const res = await _AssertValidFilename.assertValidFilename(file); | ||
expect(res).toBeUndefined(); | ||
}); | ||
|
||
it("should return defined if filename is not valid", async () => { | ||
const files = [ | ||
FileFactory({ filename: "eip-123" }), | ||
FileFactory({ filename: "ep-123.md" }), | ||
FileFactory({ filename: "eip-a.md" }), | ||
FileFactory({ filename: "eip-123.js" }) | ||
]; | ||
// @ts-expect-error below is an invalid type error | ||
expect(await _AssertValidFilename.assertValidFilename(files[0])).toBeDefined(); | ||
// @ts-expect-error below is an invalid type error | ||
expect(await _AssertValidFilename.assertValidFilename(files[1])).toBeDefined(); | ||
// @ts-expect-error below is an invalid type error | ||
expect(await _AssertValidFilename.assertValidFilename(files[2])).toBeDefined(); | ||
// @ts-expect-error below is an invalid type error | ||
expect(await _AssertValidFilename.assertValidFilename(files[3])).toBeDefined(); | ||
}); | ||
}) |
Oops, something went wrong.