-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Do not return auth config when registry names partially match
- Loading branch information
1 parent
36b6c5b
commit 726057c
Showing
7 changed files
with
42 additions
and
13 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,6 @@ | ||
module.exports = { | ||
preset: "ts-jest", | ||
testEnvironment: "node", | ||
clearMocks: true, | ||
resetMocks: true, | ||
restoreMocks: 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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import { registryMatches } from "./registry-matches"; | ||
|
||
describe("registryMatches", () => { | ||
it("should return true when registries are equal", () => { | ||
expect(registryMatches("https://registry.example.com", "https://registry.example.com")).toBe(true); | ||
}); | ||
|
||
it("should return true when registries are equal without protocol", () => { | ||
expect(registryMatches("https://registry.example.com", "registry.example.com")).toBe(true); | ||
}); | ||
|
||
it("should return false when registries do not match", () => { | ||
expect(registryMatches("https://registry.example.com", "registry.example.co")).toBe(false); | ||
}); | ||
}); |
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,2 @@ | ||
export const registryMatches = (authConfigRegistry: string, requestedRegistry: string): boolean => | ||
authConfigRegistry == requestedRegistry || authConfigRegistry.endsWith("://" + requestedRegistry); |