1
0
Fork 0

Test xar extraction

pull/207/head
Frederik Wallner 2019-11-08 09:37:02 +01:00
parent 47357ddfee
commit ca65f538e9
No known key found for this signature in database
GPG Key ID: AB5A2354F2F8FDC3
2 changed files with 31 additions and 0 deletions

Binary file not shown.

View File

@ -253,6 +253,37 @@ describe('@actions/tool-cache', function() {
fs.readFileSync(path.join(toolPath, 'foo', 'hello.txt'), 'utf8') fs.readFileSync(path.join(toolPath, 'foo', 'hello.txt'), 'utf8')
).toBe('foo/hello: world') ).toBe('foo/hello: world')
}) })
it('extract .xar', async () => {
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 () => { it('installs a zip and finds it', async () => {