generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 1
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
4 changed files
with
46 additions
and
3 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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import * as core from '@actions/core' | ||
import * as initializer from '../src/initializer' | ||
|
||
describe('initializer', () => { | ||
const infoMock = jest.spyOn(core, 'info').mockImplementation(() => {}) | ||
|
||
beforeEach(() => { | ||
jest.clearAllMocks() | ||
}) | ||
|
||
it('uses the default configuration when no config file is provided', () => { | ||
jest.spyOn(core, 'getInput').mockImplementation((name: string): string => { | ||
switch (name) { | ||
case 'configuration-file-path': | ||
return '' | ||
default: | ||
return 'foo' | ||
} | ||
}) | ||
|
||
const config = initializer.loadConfiguration() | ||
|
||
expect(config).toBeDefined() | ||
expect(infoMock).toHaveBeenCalledWith('Using default sizeup configuration') | ||
}) | ||
|
||
it('can load a custom configuration file', () => { | ||
jest.spyOn(core, 'getInput').mockImplementation((name: string): string => { | ||
switch (name) { | ||
case 'configuration-file-path': | ||
return '__tests__/test-configuration.yaml' | ||
default: | ||
return '' | ||
} | ||
}) | ||
const config = initializer.loadConfiguration() | ||
|
||
expect(config).toBeDefined() | ||
expect(infoMock).toHaveBeenCalledWith( | ||
'Reading sizeup configuration from "__tests__/test-configuration.yaml"' | ||
) | ||
}) | ||
}) |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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