From 20653abd87c116b3ffe32f61d50108360ca87d91 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Fri, 21 Feb 2020 13:07:32 +0000 Subject: [PATCH] test: Add getWorkDirName() --- __tests__/utils.test.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/__tests__/utils.test.ts b/__tests__/utils.test.ts index 14ad7c5451..17369bc1f6 100644 --- a/__tests__/utils.test.ts +++ b/__tests__/utils.test.ts @@ -16,6 +16,23 @@ beforeEach(() => { // }); +describe('getWorkDirName()', () => { + test('get work directory name', async () => { + const date = new Date(); + const unixTime = date.getTime(); + + let home = ''; + if (process.platform === 'win32') { + home = 'C:\\Users\\runneradmin'; + } else { + home = `${process.env.HOME}`; + } + const expected = path.join(home ,`actions_github_pages_${unixTime}`); + const test = await getWorkDirName(`${unixTime}`); + expect(test).toMatch(expected); + }); +}); + describe('getHomeDir()', () => { test('get home directory name', async () => { let test = '';