forked from Roblox/cla-signature-bot
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The `whitelist` input has been replaced with `allowlist`. The old input remains supported as an alias. The new input name is more inclusive and descriptive, and isn't burdened by racist connotations. The documentation has been updated, and two tests have been added to ensure that `whitelist` still works correctly as a fallback.
- Loading branch information
Showing
12 changed files
with
106 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { Allowlist } from "../src/claAllowlist" | ||
import { Author } from "../src/authorMap"; | ||
|
||
const allowlistAuthor = new Author({ | ||
name: "SomeUsername", | ||
signed: false, | ||
}); | ||
|
||
const notAllowlistAuthor = new Author({ | ||
name: "JoeRandom", | ||
signed: false | ||
}); | ||
|
||
const allowlistBot = new Author({ | ||
name: "CompanyBotForGithub", | ||
signed: false, | ||
}); | ||
|
||
const weirdName = new Author({ | ||
name: "A?Weird!User.Name@somecompany.email", | ||
signed: false, | ||
}); | ||
|
||
const emptyList = new Allowlist(""); | ||
const whitelist = new Allowlist(`${allowlistAuthor.name},CompanyBot*,${weirdName.name},`); | ||
|
||
it('Empty allowlist keeps author.', () => { | ||
expect(emptyList.isUserAllowlisted(allowlistAuthor)).toStrictEqual(false); | ||
expect(emptyList.isUserAllowlisted(notAllowlistAuthor)).toStrictEqual(false); | ||
expect(emptyList.isUserAllowlisted(allowlistBot)).toStrictEqual(false); | ||
expect(emptyList.isUserAllowlisted(weirdName)).toStrictEqual(false); | ||
}); | ||
|
||
it('Author is allowlisted', () => { | ||
expect(whitelist.isUserAllowlisted(allowlistAuthor)).toStrictEqual(true); | ||
expect(whitelist.isUserAllowlisted(notAllowlistAuthor)).toStrictEqual(false); | ||
}); | ||
|
||
it('Glob bot is allowlisted', () => { | ||
expect(whitelist.isUserAllowlisted(allowlistBot)).toStrictEqual(true); | ||
}); | ||
|
||
it('Username with special characters is still allowlisted', () => { | ||
expect(whitelist.isUserAllowlisted(weirdName)).toStrictEqual(true); | ||
}); |
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 was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -66,13 +66,27 @@ it('sets defaults', () => { | |
expect(settings.localRepositoryOwner).toBe("some-owner"); | ||
expect(settings.repositoryAccessToken).toBe(settings.localAccessToken); | ||
expect(settings.claFilePath).toBeTruthy(); | ||
expect(settings.whitelist).toBeFalsy(); | ||
expect(settings.allowlist).toBeFalsy(); | ||
expect(settings.emptyCommitFlag).toBe(false); | ||
|
||
expect(settings.octokitRemote).toBeTruthy(); | ||
expect(settings.octokitLocal).toBeTruthy(); | ||
}) | ||
|
||
it('Accepts allowlist', () => { | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong.
Gudahtt
Author
Member
|
||
inputs["url-to-cladocument"] = "some/path/to/a/doc.md"; | ||
inputs["allowlist"] = "some-allowed-user,another-allowed-user"; | ||
const settings: IInputSettings = inputHelper.getInputs(); | ||
expect(settings.allowlist).toBe("some-allowed-user,another-allowed-user"); | ||
}) | ||
|
||
it("Accepts allowlist as alias 'whitelist'", () => { | ||
inputs["url-to-cladocument"] = "some/path/to/a/doc.md"; | ||
inputs["whitelist"] = "some-allowed-user,another-allowed-user"; | ||
const settings: IInputSettings = inputHelper.getInputs(); | ||
expect(settings.allowlist).toBe("some-allowed-user,another-allowed-user"); | ||
}) | ||
|
||
it('Rejects invalid repository name arguments', () => { | ||
inputs["url-to-cladocument"] = "some/path/to/a/doc.md"; | ||
inputs["use-remote-repo"] = "true"; | ||
|
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Were there no existing
whitelist
test cases?