UNPKG

mediacentral-publish

Version:

A publish tool for publishing cloud-ux projects

23 lines (19 loc) 1.17 kB
function _asyncToGenerator(fn) { return function () { var gen = fn.apply(this, arguments); return new Promise(function (resolve, reject) { function step(key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { return Promise.resolve(value).then(function (value) { step("next", value); }, function (err) { step("throw", err); }); } } return step("next"); }); }; } const constants = require('../tests/constants'); const fs = require('./fs'); describe('publish', () => { beforeEach(_asyncToGenerator(function* () { yield fs.removePromise(constants.fs_mkdir_path); })); afterEach(_asyncToGenerator(function* () { yield fs.removePromise(constants.fs_mkdir_path); })); it('mkdir', _asyncToGenerator(function* () { yield fs.mkdirPromise(constants.fs_mkdir_path); expect((yield fs.existsPromise(constants.fs_mkdir_path))).toBeTruthy(); })); it('readFile', _asyncToGenerator(function* () { const file = JSON.parse((yield fs.readFilePromise(constants.fs_file_path))); expect(file.message).toEqual('Hello'); })); });