feature/host-overrides (#161)
* configurable host overrides * base host overrides on name of service instead of key and hide the options by default * added unit tests * review changes * Refactor options * Refactor * Update Readme * Pump version and update Changelog Co-authored-by: Tobias Jacksteit <me@xtj7.de>
This commit is contained in:
@@ -6,7 +6,7 @@ describe("utils", () => {
|
||||
let matcher
|
||||
|
||||
beforeEach(() => {
|
||||
matcher = createMatcher(remoteServices)
|
||||
matcher = createMatcher(remoteServices, {})
|
||||
})
|
||||
|
||||
describe("createMatcher", () => {
|
||||
@@ -162,4 +162,27 @@ describe("utils", () => {
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
describe("urlMatcher with overrideHosts", () => {
|
||||
let matcher
|
||||
|
||||
beforeEach(() => {
|
||||
matcher = createMatcher(remoteServices, {
|
||||
github: "https://my-custom-github-url.com",
|
||||
})
|
||||
})
|
||||
|
||||
describe("createMatcher", () => {
|
||||
it("matches overridden host and path", () => {
|
||||
const service = matcher("https://my-custom-github-url.com/hundertzehn/mocoapp/pull/123")
|
||||
expect(service.key).toEqual("github-pr")
|
||||
expect(service.name).toEqual("github")
|
||||
})
|
||||
|
||||
it("doesn't match default host and path", () => {
|
||||
const service = matcher("https://github.com/hundertzehn/mocoapp/pull/123")
|
||||
expect(service).toBe(undefined)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user