UNPKG

memory-card

Version:

ES6 Map like Async API, with Swagger API Backend Support.

24 lines 1.09 kB
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tstest_1 = require("tstest"); const fixtures_js_1 = require("../../tests/fixtures.js"); const s3_js_1 = require("./s3.js"); (0, tstest_1.test)('amazon s3 storage smoke testing', async (t) => { if (!fixtures_js_1.AWS_SETTING) { await t.skip('AWS S3 environment variables not set.'); return; } const EXPECTED_PAYLOAD = { mol: 42 }; const NAME = 'tmp/memory-card-unit-test-' + Math.random().toString().substr(2); const s3 = new s3_js_1.StorageS3(NAME, fixtures_js_1.AWS_SETTING); let empty = await s3.load(); t.deepEqual(empty, {}, 'should get back a empty object for non-exist data'); await s3.save(EXPECTED_PAYLOAD); const payload = await s3.load(); t.deepEqual(payload, EXPECTED_PAYLOAD, 'should get back data from s3'); await s3.destroy(); empty = await s3.load(); t.deepEqual(empty, {}, 'should get back a empty object after destroy()'); }); //# sourceMappingURL=s3.spec.js.map