added unit tests

This commit is contained in:
Tobias Jacksteit
2020-06-03 15:01:38 +08:00
parent 45cd9dbbe9
commit 5900cb997a

View File

@@ -6,7 +6,7 @@ describe("utils", () => {
let matcher let matcher
beforeEach(() => { beforeEach(() => {
matcher = createMatcher(remoteServices) matcher = createMatcher(remoteServices, {})
}) })
describe("createMatcher", () => { 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)
})
})
})
}) })