sdk-monorepo/test/data.test.ts
2023-05-13 19:30:21 +00:00

27 lines
897 B
TypeScript

import chai from 'chai'
import { ErrorUtils } from '@tornado/sdk-utils'
import { Cache, Files } from '@tornado/sdk-data'
const expect = chai.expect
describe('data', () => {
if (!process.env.EXPORT_TEST_DIRNAME)
throw ErrorUtils.getError('data.test.ts: no cache test dirname provided')
it(`Files.gzipSync: should be able to zip dir`, () => {
const filepath = Files.getCachePath(process.env.EXPORT_TEST_DIRNAME!)
Files.gzipSync(filepath, filepath)
})
it(`Files.gunzipSync: should be able to unzip dir`, () => {
const filepath = Files.getCachePath(process.env.EXPORT_TEST_DIRNAME!)
Files.gunzipSync(filepath, Files.getCachePath())
})
it(`Cache.zip: should be able to zip or load from zip ${process.env.EXPORT_TEST_DIRNAME}`, async () => {
const cache = new Cache.Base(process.env.EXPORT_TEST_DIRNAME!)
await cache.zip(undefined, true)
}).timeout(0)
})