feat(account): create browser environments before verified login
douyin-release-gate / verify (push) Failing after 4m22s
douyin-release-gate / verify (push) Failing after 4m22s
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
const assert = require('node:assert/strict');
|
||||
const { readFileSync } = require('node:fs');
|
||||
const { test } = require('node:test');
|
||||
const ts = require('typescript');
|
||||
const source = readFileSync(`${__dirname}/../src/utils/helpers.ts`, 'utf8');
|
||||
const compiled = ts.transpileModule(source, { compilerOptions: { module: ts.ModuleKind.CommonJS } }).outputText;
|
||||
const loaded = { exports: {} };
|
||||
new Function('module', 'exports', compiled)(loaded, loaded.exports);
|
||||
const { conflictMessage } = loaded.exports;
|
||||
|
||||
test('不可用错误显示后端具体原因,而不是通用 capability 提示', () => {
|
||||
assert.equal(conflictMessage({ status: 503, message: 'creator capability is unavailable', body: { error: 'creator capability is unavailable', reason: 'browser runtime is not running' } }), 'browser runtime is not running');
|
||||
});
|
||||
|
||||
test('没有具体原因时保留原始错误,409 保留操作提示与原因码', () => {
|
||||
assert.equal(conflictMessage({ status: 502, message: 'gateway unavailable' }), 'gateway unavailable');
|
||||
assert.equal(conflictMessage({ status: 409, message: 'conflict', body: { reason_code: 'account_paused' } }, '请恢复账号'), 'conflict:请恢复账号(account_paused)');
|
||||
});
|
||||
Reference in New Issue
Block a user