Files
cache-extensions/__tests__/utils.test.ts
Shivam Mathur 546224a999 init
2020-02-13 10:06:22 +05:30

23 lines
721 B
TypeScript

import * as fs from 'fs';
import * as path from 'path';
import * as utils from '../src/utils';
jest.mock('@actions/core', () => ({
getInput: jest.fn().mockImplementation(key => {
return ['cache-extensions'].indexOf(key) !== -1 ? key : '';
})
}));
describe('Utils tests', () => {
it('checking getInput', async () => {
process.env['test'] = 'cache-extensions';
process.env['undefined'] = '';
expect(await utils.getInput('test', false)).toBe('cache-extensions');
expect(await utils.getInput('undefined', false)).toBe('');
expect(await utils.getInput('cache-extensions', false)).toBe(
'cache-extensions'
);
expect(await utils.getInput('DoesNotExist', false)).toBe('');
});
});