Skip to content

Commit

Permalink
Move tools config to tools.json
Browse files Browse the repository at this point in the history
Refactor tools functions to use Records and object literals
  • Loading branch information
shivammathur committed Jul 7, 2021
1 parent 60ff774 commit 6449431
Show file tree
Hide file tree
Showing 11 changed files with 1,203 additions and 797 deletions.
405 changes: 244 additions & 161 deletions __tests__/tools.test.ts

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions __tests__/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ describe('Utils tests', () => {
expect(await utils.getInput('test', false)).toBe('setup-php');
expect(await utils.getInput('setup-php', false)).toBe('setup-php');
expect(await utils.getInput('DoesNotExist', false)).toBe('');
expect(async () => {
await expect(async () => {
await utils.getInput('DoesNotExist', true);
}).rejects.toThrow('Input required and not supplied: DoesNotExist');
});
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('Utils tests', () => {
expect(await utils.color('warning')).toBe('33');
});

it('checking readScripts', async () => {
it('checking readFile', async () => {
const darwin: string = fs.readFileSync(
path.join(__dirname, '../src/scripts/darwin.sh'),
'utf8'
Expand All @@ -83,12 +83,12 @@ describe('Utils tests', () => {
path.join(__dirname, '../src/scripts/win32.ps1'),
'utf8'
);
expect(await utils.readScript('darwin.sh')).toBe(darwin);
expect(await utils.readScript('darwin.sh')).toBe(darwin);
expect(await utils.readScript('linux.sh')).toBe(linux);
expect(await utils.readScript('linux.sh')).toBe(linux);
expect(await utils.readScript('win32.ps1')).toBe(win32);
expect(await utils.readScript('win32.ps1')).toBe(win32);
expect(await utils.readFile('darwin.sh', 'src/scripts')).toBe(darwin);
expect(await utils.readFile('darwin.sh', 'src/scripts')).toBe(darwin);
expect(await utils.readFile('linux.sh', 'src/scripts')).toBe(linux);
expect(await utils.readFile('linux.sh', 'src/scripts')).toBe(linux);
expect(await utils.readFile('win32.ps1', 'src/scripts')).toBe(win32);
expect(await utils.readFile('win32.ps1', 'src/scripts')).toBe(win32);
});

it('checking writeScripts', async () => {
Expand Down
Loading

0 comments on commit 6449431

Please sign in to comment.