Fix code styles
This commit is contained in:
@@ -11,16 +11,14 @@ describe("utils", () => {
|
||||
|
||||
describe("createMatcher", () => {
|
||||
it("matches host and path", () => {
|
||||
const service = matcher(
|
||||
"https://github.com/hundertzehn/mocoapp/pull/123"
|
||||
)
|
||||
const service = matcher("https://github.com/hundertzehn/mocoapp/pull/123")
|
||||
expect(service.key).toEqual("github-pr")
|
||||
expect(service.name).toEqual("github")
|
||||
})
|
||||
|
||||
it("matches query string", () => {
|
||||
let service = matcher(
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa?rapidView=2&projectKey=TEST1&modal=detail&selectedIssue=TEST1-1"
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa?rapidView=2&projectKey=TEST1&modal=detail&selectedIssue=TEST1-1",
|
||||
)
|
||||
expect(service.key).toEqual("jira")
|
||||
expect(service.name).toEqual("jira")
|
||||
@@ -32,7 +30,7 @@ describe("utils", () => {
|
||||
expect(service.match.id).toEqual("TEST1-1")
|
||||
|
||||
service = matcher(
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa?rapidView=2&projectKey=TEST1&modal=detail"
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa?rapidView=2&projectKey=TEST1&modal=detail",
|
||||
)
|
||||
expect(service.key).toEqual("jira")
|
||||
expect(service.name).toEqual("jira")
|
||||
@@ -44,7 +42,7 @@ describe("utils", () => {
|
||||
expect(service.match.id).toBeUndefined()
|
||||
|
||||
service = matcher(
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa?rapidView=2&projectKey=TEST1&modal=detail&selectedIssue="
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa?rapidView=2&projectKey=TEST1&modal=detail&selectedIssue=",
|
||||
)
|
||||
expect(service.key).toEqual("jira")
|
||||
expect(service.name).toEqual("jira")
|
||||
@@ -55,9 +53,7 @@ describe("utils", () => {
|
||||
expect(service.match.projectId).toEqual("TEST1")
|
||||
expect(service.match.id).toEqual("")
|
||||
|
||||
service = matcher(
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa"
|
||||
)
|
||||
service = matcher("https://moco-bx.atlassian.net/secure/RapidBoard.jspa")
|
||||
expect(service.key).toEqual("jira")
|
||||
expect(service.name).toEqual("jira")
|
||||
expect(service.match.org).toEqual("moco-bx")
|
||||
@@ -65,7 +61,7 @@ describe("utils", () => {
|
||||
expect(service.match.id).toBeUndefined()
|
||||
|
||||
service = matcher(
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa?rapidView=2&modal=detail&selectedIssue=TEST2-1"
|
||||
"https://moco-bx.atlassian.net/secure/RapidBoard.jspa?rapidView=2&modal=detail&selectedIssue=TEST2-1",
|
||||
)
|
||||
expect(service.key).toEqual("jira")
|
||||
expect(service.name).toEqual("jira")
|
||||
@@ -78,18 +74,14 @@ describe("utils", () => {
|
||||
})
|
||||
|
||||
it("matches url with hash", () => {
|
||||
let service = matcher(
|
||||
"https://www.wunderlist.com/webapp#/tasks/4771178545"
|
||||
)
|
||||
let service = matcher("https://www.wunderlist.com/webapp#/tasks/4771178545")
|
||||
expect(service.key).toEqual("wunderlist")
|
||||
expect(service.name).toEqual("wunderlist")
|
||||
expect(service.match.id).toEqual("4771178545")
|
||||
})
|
||||
|
||||
it("does not match different host", () => {
|
||||
const service = matcher(
|
||||
"https://trello.com/hundertzehn/mocoapp/pull/123"
|
||||
)
|
||||
const service = matcher("https://trello.com/hundertzehn/mocoapp/pull/123")
|
||||
expect(service).toBeFalsy()
|
||||
})
|
||||
})
|
||||
@@ -98,9 +90,7 @@ describe("utils", () => {
|
||||
it("enhances a services", () => {
|
||||
const url = "https://github.com/hundertzehn/mocoapp/pull/123"
|
||||
const document = {
|
||||
querySelector: jest
|
||||
.fn()
|
||||
.mockReturnValue({ textContent: "[4321] Foo" })
|
||||
querySelector: jest.fn().mockReturnValue({ textContent: "[4321] Foo" }),
|
||||
}
|
||||
const service = matcher(url)
|
||||
const enhancedService = createEnhancer(document)(service)
|
||||
|
||||
Reference in New Issue
Block a user