-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(link): add more coverage for the creation of link
- Loading branch information
Showing
5 changed files
with
49 additions
and
22 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,14 +1,14 @@ | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = false | ||
# Editor configuration, see https://editorconfig.org | ||
root = true | ||
|
||
[*] | ||
charset = utf-8 | ||
indent_style = space | ||
indent_size = 2 | ||
insert_final_newline = true | ||
trim_trailing_whitespace = true | ||
end_of_line = lf | ||
|
||
[*.md] | ||
max_line_length = off | ||
trim_trailing_whitespace = 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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
[alias] | ||
branch-name = "!git rev-parse --abbrev-ref HEAD" | ||
push-upstream = "!f(){ git push -u origin $(git branch-name); };f" | ||
[alias] | ||
branch-name = "!git rev-parse --abbrev-ref HEAD" | ||
push-upstream = "!f(){ git push -u origin $(git branch-name); };f" |
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,4 +1,4 @@ | ||
label-alias: | ||
bug: 'bug' | ||
feature_request: 'feature-request' | ||
question: 'question' | ||
label-alias: | ||
bug: 'bug' | ||
feature_request: 'feature-request' | ||
question: 'question' |
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 +1 @@ | ||
access=public | ||
access=public |
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,27 @@ | ||
import { createLink } from './create-link'; | ||
import * as faker from 'faker'; | ||
import * as TerminalLinkModule from 'terminal-link'; | ||
|
||
describe(`createLink()`, (): void => { | ||
let name: string; | ||
let link: string; | ||
|
||
let terminalLinkSpy: jest.SpyInstance; | ||
|
||
beforeEach((): void => { | ||
name = faker.random.word(); | ||
link = faker.internet.url(); | ||
|
||
terminalLinkSpy = jest.spyOn(TerminalLinkModule, `default`).mockReturnValue(`dummy-link`); | ||
}); | ||
|
||
it(`should create a link formatted for a terminal and return it`, (): void => { | ||
expect.assertions(3); | ||
|
||
const result = createLink(name, link); | ||
|
||
expect(terminalLinkSpy).toHaveBeenCalledTimes(1); | ||
expect(terminalLinkSpy).toHaveBeenCalledWith(name, link); | ||
expect(result).toStrictEqual(`dummy-link`); | ||
}); | ||
}); |