sdk-monorepo/test/data.test.ts
AlienTornadosaurusHex c5478b159d 0.0.12-alpha: Check HISTORY.md
Signed-off-by: AlienTornadosaurusHex <>
2023-05-31 20:53:28 +00:00

32 lines
1.0 KiB
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.jsonify: should be able to write db docs to json`, async () => {
const cache = new Cache.Base(process.env.EXPORT_TEST_DIRNAME!)
await cache.jsonify()
})
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)
})