@juzi/wechaty-puppet-whatsapp
Version:
Wechaty Puppet for WhatsApp
27 lines • 1.39 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const tstest_1 = require("tstest");
const error_type_js_1 = require("./error-type.js");
const whatsapp_error_js_1 = __importDefault(require("./whatsapp-error.js"));
function throwError() {
throw (0, whatsapp_error_js_1.default)(error_type_js_1.WA_ERROR_TYPE.ERR_INIT, 'no cache manager');
}
(0, tstest_1.test)('WAError should throw', async (t) => {
t.throws(throwError, whatsapp_error_js_1.default, (0, whatsapp_error_js_1.default)(error_type_js_1.WA_ERROR_TYPE.ERR_INIT, 'no cache manager'));
t.pass('WAError should throw pass');
});
(0, tstest_1.test)('WAError instanceof error', async (t) => {
const err = (0, whatsapp_error_js_1.default)(error_type_js_1.WA_ERROR_TYPE.ERR_INIT, 'no cache manager');
t.ok(err instanceof Error);
t.pass('WAError instanceof error pass');
});
(0, tstest_1.test)('WAError should has message', async (t) => {
const err = (0, whatsapp_error_js_1.default)(error_type_js_1.WA_ERROR_TYPE.ERR_INIT, 'no cache manager');
t.ok(err.message === 'no cache manager');
t.pass('WAError should has message pass');
});
//# sourceMappingURL=whatsapp-error.spec.js.map