c5478b159d
Signed-off-by: AlienTornadosaurusHex <>
32 lines
1.0 KiB
TypeScript
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)
|
|
})
|