forked from ziishaned/jest-reporter-action
-
Notifications
You must be signed in to change notification settings - Fork 100
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
127 additions
and
104 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
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 |
---|---|---|
@@ -1,87 +1,86 @@ | ||
import { createHref } from "./util" | ||
|
||
test('create simple url to file', () => { | ||
const options = { | ||
repository: "example/foo", | ||
commit: "2e15bee6fe0df5003389aa5ec894ec0fea2d874a", | ||
prefix: "/files/project/", | ||
} | ||
const file = { | ||
file: "/files/project/index.js", | ||
functions: { | ||
found: 0, | ||
hit: 0, | ||
details: [], | ||
}, | ||
} | ||
expect(createHref(options, file)).toEqual({ | ||
href: `https://github.com/${options.repository}/blob/${options.commit}/index.js`, | ||
filename: 'index.js' | ||
}) | ||
test("create simple url to file", () => { | ||
const options = { | ||
repository: "example/foo", | ||
commit: "2e15bee6fe0df5003389aa5ec894ec0fea2d874a", | ||
prefix: "/files/project/", | ||
} | ||
const file = { | ||
file: "/files/project/index.js", | ||
functions: { | ||
found: 0, | ||
hit: 0, | ||
details: [], | ||
}, | ||
} | ||
expect(createHref(options, file)).toEqual({ | ||
href: `https://github.com/${options.repository}/blob/${options.commit}/index.js`, | ||
filename: "index.js", | ||
}) | ||
}) | ||
|
||
describe('has working directory', () => { | ||
test('create url to file with simple working dir path', () => { | ||
const options = { | ||
repository: "example/foo", | ||
commit: "2e15bee6fe0df5003389aa5ec894ec0fea2d874a", | ||
prefix: "/files/project/", | ||
workingDir: 'frontend' | ||
} | ||
const file = { | ||
file: "/files/project/index.js", | ||
functions: { | ||
found: 0, | ||
hit: 0, | ||
details: [], | ||
}, | ||
} | ||
expect(createHref(options, file)).toEqual({ | ||
href: `https://github.com/${options.repository}/blob/${options.commit}/frontend/index.js`, | ||
filename: 'index.js' | ||
}) | ||
}) | ||
describe("has working directory", () => { | ||
test("create url to file with simple working dir path", () => { | ||
const options = { | ||
repository: "example/foo", | ||
commit: "2e15bee6fe0df5003389aa5ec894ec0fea2d874a", | ||
prefix: "/files/project/", | ||
workingDir: "frontend", | ||
} | ||
const file = { | ||
file: "/files/project/index.js", | ||
functions: { | ||
found: 0, | ||
hit: 0, | ||
details: [], | ||
}, | ||
} | ||
expect(createHref(options, file)).toEqual({ | ||
href: `https://github.com/${options.repository}/blob/${options.commit}/frontend/index.js`, | ||
filename: "index.js", | ||
}) | ||
}) | ||
|
||
test('working dir relative path', () => { | ||
const options = { | ||
repository: "example/foo", | ||
commit: "2e15bee6fe0df5003389aa5ec894ec0fea2d874a", | ||
prefix: "/files/project/", | ||
workingDir: './frontend/' | ||
} | ||
const file = { | ||
file: "/files/project/index.js", | ||
functions: { | ||
found: 0, | ||
hit: 0, | ||
details: [], | ||
}, | ||
} | ||
expect(createHref(options, file)).toEqual({ | ||
href: `https://github.com/${options.repository}/blob/${options.commit}/frontend/index.js`, | ||
filename: 'index.js' | ||
}) | ||
}) | ||
|
||
test('working dir path with leading and trailing slashed', () => { | ||
const options = { | ||
repository: "example/foo", | ||
commit: "2e15bee6fe0df5003389aa5ec894ec0fea2d874a", | ||
prefix: "/files/project/", | ||
workingDir: '/frontend/' | ||
} | ||
const file = { | ||
file: "/files/project/src/foo.js", | ||
functions: { | ||
found: 0, | ||
hit: 0, | ||
details: [], | ||
}, | ||
} | ||
expect(createHref(options, file)).toEqual({ | ||
href: `https://github.com/${options.repository}/blob/${options.commit}/frontend/src/foo.js`, | ||
filename: 'foo.js' | ||
}) | ||
}) | ||
test("working dir relative path", () => { | ||
const options = { | ||
repository: "example/foo", | ||
commit: "2e15bee6fe0df5003389aa5ec894ec0fea2d874a", | ||
prefix: "/files/project/", | ||
workingDir: "./frontend/", | ||
} | ||
const file = { | ||
file: "/files/project/index.js", | ||
functions: { | ||
found: 0, | ||
hit: 0, | ||
details: [], | ||
}, | ||
} | ||
expect(createHref(options, file)).toEqual({ | ||
href: `https://github.com/${options.repository}/blob/${options.commit}/frontend/index.js`, | ||
filename: "index.js", | ||
}) | ||
}) | ||
|
||
test("working dir path with leading and trailing slashed", () => { | ||
const options = { | ||
repository: "example/foo", | ||
commit: "2e15bee6fe0df5003389aa5ec894ec0fea2d874a", | ||
prefix: "/files/project/", | ||
workingDir: "/frontend/", | ||
} | ||
const file = { | ||
file: "/files/project/src/foo.js", | ||
functions: { | ||
found: 0, | ||
hit: 0, | ||
details: [], | ||
}, | ||
} | ||
expect(createHref(options, file)).toEqual({ | ||
href: `https://github.com/${options.repository}/blob/${options.commit}/frontend/src/foo.js`, | ||
filename: "foo.js", | ||
}) | ||
}) | ||
}) |