UNPKG

wechaty-puppet-official-account

Version:
48 lines 1.65 kB
#!/usr/bin/env -S node --no-warnings --loader ts-node/esm "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); require("dotenv/config.js"); const tstest_1 = require("tstest"); const wechaty_1 = require("wechaty"); const mod_js_1 = require("../src/mod.js"); const oa_options_js_1 = require("./fixtures/oa-options.js"); const ci_info_1 = __importDefault(require("ci-info")); (0, tstest_1.test)('integration testing', async (t) => { if (ci_info_1.default.isPR) { void t.skip('Skip for PR'); return; } const puppet = new mod_js_1.PuppetOA({ ...(0, oa_options_js_1.getOaOptions)(), }); const wechaty = wechaty_1.WechatyBuilder.build({ puppet }); t.ok(wechaty, 'should instantiate wechaty with puppet official account'); }); (0, tstest_1.test)('PuppetOA perfect restart testing', async (t) => { if (ci_info_1.default.isPR) { void t.skip('Skip for PR'); return; } const puppet = new mod_js_1.PuppetOA({ ...(0, oa_options_js_1.getOaOptions)(), port: 0, webhookProxyUrl: undefined, }); try { for (let i = 0; i < 3; i++) { await puppet.start(); t.ok(puppet.state.active()); await puppet.stop(); t.ok(puppet.state.inactive()); t.pass('start/stop-ed at #' + i); } t.pass('PuppetOA() perfect restart pass.'); } catch (e) { t.fail(e); } }); //# sourceMappingURL=integration.spec.js.map