From ca65f538e9d6681bf17baa20f6f661a7551ce645 Mon Sep 17 00:00:00 2001 From: Frederik Wallner Date: Fri, 8 Nov 2019 09:37:02 +0100 Subject: [PATCH] Test xar extraction --- packages/tool-cache/__tests__/data/test.xar | Bin 0 -> 1020 bytes .../tool-cache/__tests__/tool-cache.test.ts | 31 ++++++++++++++++++ 2 files changed, 31 insertions(+) create mode 100644 packages/tool-cache/__tests__/data/test.xar diff --git a/packages/tool-cache/__tests__/data/test.xar b/packages/tool-cache/__tests__/data/test.xar new file mode 100644 index 0000000000000000000000000000000000000000..a247014792c29002f7f909be8c74a39fa68f3a55 GIT binary patch literal 1020 zcmV2dq_?o%YUAG3$_tn2JyleU!!w@qqlr`s?hYKx=GFai|; zL`d$COu_{sjpven(B7FZ>{7w66#ExNY_twq4IAt-Nnso1ruwt=`)dU%TLG+#6kp zc#6@td~tA_!ai=v80J$^T37$o&FpsLw835KvTB^EO50=i0T>~mQ8b@XwPi3pJh#12?OMS^&c9j`Kd7fmEo zCKQ59Uu92q^?b^jR(qeuLu2q4w%@$&-aDQfS7*LH13;2M^G>X!8J*bm30{s zC=Bn--f7)SVO&{dz=aUFi+yqRf}-rS1S?>e(lj30eOLQ>a+xh^XWFWM4O`i@ABMvT z58|ssSXFl-(^Fl}mTt$hvAWfRxk(SMd}{X@QE5DyW5<|2Le4U2$|VBVT3pDOweBHzqSmw0!6iBHg z4YQCXWG>7I6rqr%utO;6uNz+0fLS315~^mztRe$=hRixMWX8-YH22i3W3#}`1P<@A z{{qh2=vDoosNeaY({QM*K~Q*b$)2i?JYoY=Nw*|7wZBQ9$%O@=`eDH*&L~f zC`RT)4M24-`YTZH;OR}Aaxg%#5QH)%9P*ZW6!KjwCv#v_2fi2uZ`W~pizWlP)s!)7 zoXIUx3IW%^l{cOTRt=z>5MtFDO*b(8(S?U6SiV(whG_hE6`nai?<+iFq40bM&scNr zpjjdXR!JdbnG}qcNa?uxHKg!d8g4xEh+*U$voh2OuCxQj1d&dKQh}{h|DP0(fXO^J ziW-~e)C!6m=FSNx1jW=U?m2Uw{Z3MTRBnFF=Nb7KN+4nIM^M7wK}qya(e9)F{tc(9 z`vj_2xCx`XAA~gSe;2+1009600|0l|n}fzxHsd)Q{qJW|T2so2vilO63ygT$OUukj z)h*8~$ { + const tempDir = path.join(tempPath, 'test-install.xar') + + await io.mkdirP(tempDir) + + // copy the .xar file to the test dir + const _xarFile: string = path.join(tempDir, 'test.xar') + await io.cp(path.join(__dirname, 'data', 'test.xar'), _xarFile) + + // extract/cache + const extPath: string = await tc.extractXar(_xarFile, undefined, '-x') + await tc.cacheDir(extPath, 'my-xar-contents', '1.1.0') + const toolPath: string = tc.find('my-xar-contents', '1.1.0') + + expect(fs.existsSync(toolPath)).toBeTruthy() + expect(fs.existsSync(`${toolPath}.complete`)).toBeTruthy() + expect(fs.existsSync(path.join(toolPath, 'file.txt'))).toBeTruthy() + expect( + fs.existsSync(path.join(toolPath, 'file-with-รง-character.txt')) + ).toBeTruthy() + expect( + fs.existsSync(path.join(toolPath, 'folder', 'nested-file.txt')) + ).toBeTruthy() + expect( + fs.readFileSync( + path.join(toolPath, 'folder', 'nested-file.txt'), + 'utf8' + ) + ).toBe('folder/nested-file.txt contents') + }) } it('installs a zip and finds it', async () => {