generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
Showing
16 changed files
with
153 additions
and
97 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
describe('DotnetOutdatedCommandProblemError', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
jest.resetModules(); | ||
}); | ||
|
||
it('should create an instance of DotnetCommandProblemError with the correct properties', async () => { | ||
const projectName = 'testInput.csproj'; | ||
const message = 'Project not restored'; | ||
|
||
const { DotnetCommandProblemError } = await import("../../src/errors/dotnetCommandProblemError"); | ||
const error = new DotnetCommandProblemError(projectName, message); | ||
|
||
expect(error).toBeInstanceOf(DotnetCommandProblemError); | ||
expect(error.name).toBe('DotnetCommandProblemError'); | ||
expect(error.projectName).toBe(projectName); | ||
expect(error.message).toBe(message); | ||
}); | ||
|
||
it('should have a stack trace', async () => { | ||
const projectName = 'testInput.csproj'; | ||
const message = 'Project not restored'; | ||
|
||
const { DotnetCommandProblemError } = await import("../../src/errors/dotnetCommandProblemError"); | ||
const error = new DotnetCommandProblemError(projectName, message); | ||
|
||
expect(error.stack).toBeDefined(); | ||
}); | ||
}); |
29 changes: 0 additions & 29 deletions
29
__tests__/errors/dotnetOutdatedCommandProblemError.test.ts
This file was deleted.
Oops, something went wrong.
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,29 @@ | ||
describe('InvalidGitHubActionInputError', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
jest.resetModules(); | ||
}); | ||
|
||
it('should create an instance of InvalidGitHubActionInputError with the correct properties', async () => { | ||
const inputName = 'testInput'; | ||
const message = 'Invalid input provided'; | ||
|
||
const { InvalidGitHubActionInputError } = await import("../../src/errors/invalidGitHubActionInputError"); | ||
const error = new InvalidGitHubActionInputError(inputName, message); | ||
|
||
expect(error).toBeInstanceOf(InvalidGitHubActionInputError); | ||
expect(error.name).toBe('InvalidGitHubActionInputError'); | ||
expect(error.inputName).toBe(inputName); | ||
expect(error.message).toBe(message); | ||
}); | ||
|
||
it('should have a stack trace', async () => { | ||
const inputName = 'testInput'; | ||
const message = 'Invalid input provided'; | ||
|
||
const { InvalidGitHubActionInputError } = await import("../../src/errors/invalidGitHubActionInputError"); | ||
const error = new InvalidGitHubActionInputError(inputName, message); | ||
|
||
expect(error.stack).toBeDefined(); | ||
}); | ||
}); |
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { | ||
isValidJSON | ||
} from '../../src/helpers/jsonHelper'; | ||
|
||
describe('getStringInput', () => { | ||
beforeEach(() => { | ||
jest.clearAllMocks(); | ||
jest.resetModules(); | ||
}); | ||
|
||
test.each([ | ||
['', false], | ||
['{}', true], | ||
['Error encountered', false], | ||
])('should return null when the input is "%s"', async (input: string, expected: boolean) => { | ||
const result = isValidJSON(input); | ||
|
||
expect(result).toBe(expected); | ||
}); | ||
}); |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
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
6 changes: 3 additions & 3 deletions
6
...rors/dotnetOutdatedCommandProblemError.ts → src/errors/dotnetCommandProblemError.ts
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,16 +1,16 @@ | ||
/** | ||
* Error indicating a dotnet outdated command problem | ||
*/ | ||
class DotnetOutdatedCommandProblemError extends Error { | ||
class DotnetCommandProblemError extends Error { | ||
projectName: string; | ||
|
||
constructor(projectName: string, message: string) { | ||
super(message); | ||
this.name = 'DotnetOutdatedCommandProblemError'; | ||
this.name = 'DotnetCommandProblemError'; | ||
this.projectName = projectName; | ||
} | ||
} | ||
|
||
export { | ||
DotnetOutdatedCommandProblemError | ||
DotnetCommandProblemError | ||
}; |
6 changes: 3 additions & 3 deletions
6
src/errors/invalidGitHubActionsInputError.ts → src/errors/invalidGitHubActionInputError.ts
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,16 +1,16 @@ | ||
/** | ||
* Error indicating a GitHub Actions Input error | ||
*/ | ||
class InvalidGitHubActionsInputError extends Error { | ||
class InvalidGitHubActionInputError extends Error { | ||
inputName: string; | ||
|
||
constructor(inputName: string, message: string) { | ||
super(message); | ||
this.name = 'InvalidGitHubActionsInputError'; | ||
this.name = 'InvalidGitHubActionInputError'; | ||
this.inputName = inputName; | ||
} | ||
} | ||
|
||
export { | ||
InvalidGitHubActionsInputError | ||
InvalidGitHubActionInputError | ||
}; |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
function isValidJSON( | ||
input: string): boolean { | ||
try { | ||
JSON.parse(input); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
export { | ||
isValidJSON | ||
}; |
Oops, something went wrong.