提交 d6f2e236 编写于 作者: 雪洛's avatar 雪洛

test: 增加云对象errSubject测试

上级 925f0fda
...@@ -34,6 +34,7 @@ describe('unicloud-import-object', () => { ...@@ -34,6 +34,7 @@ describe('unicloud-import-object', () => {
expect(genericDemoReturnTodoTitle).toBe(todoTitle) expect(genericDemoReturnTodoTitle).toBe(todoTitle)
expect(genericDemoReturnTodoContent).toBe(todoContent) expect(genericDemoReturnTodoContent).toBe(todoContent)
expect(failErrCode).toBe('TEST_ERROR_CODE') expect(failErrCode).toBe('TEST_ERROR_CODE')
expect(failErrSubject).toBe('fail')
expect(failErrDetailTips).toBe('DO_NOT_TRY_AGAIN') expect(failErrDetailTips).toBe('DO_NOT_TRY_AGAIN')
expect(failNumberErrCode).toBe(-1) expect(failNumberErrCode).toBe(-1)
expect(successErrCode).toBe(0) expect(successErrCode).toBe(0)
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
genericDemoReturnTodoTitle: '', genericDemoReturnTodoTitle: '',
genericDemoReturnTodoContent: '', genericDemoReturnTodoContent: '',
failErrCode: '', failErrCode: '',
failErrSubject: '',
failErrDetailTips: '', failErrDetailTips: '',
failNumberErrCode: 0, failNumberErrCode: 0,
successErrCode: -1, successErrCode: -1,
...@@ -124,6 +125,7 @@ ...@@ -124,6 +125,7 @@
}).catch((err : any | null) => { }).catch((err : any | null) => {
const error = err as UniCloudError const error = err as UniCloudError
this.failErrCode = error.errCode as string this.failErrCode = error.errCode as string
this.failErrSubject = error.errSubject as string
const detail = error.detail const detail = error.detail
if (detail != null && detail['tips'] != null) { if (detail != null && detail['tips'] != null) {
this.failErrDetailTips = detail['tips'] as string this.failErrDetailTips = detail['tips'] as string
......
...@@ -14,6 +14,7 @@ module.exports = { ...@@ -14,6 +14,7 @@ module.exports = {
console.log(random); console.log(random);
if (random > 0.5) { if (random > 0.5) {
return { return {
errSubject: 'randomFail',
errCode: 'RANDOM_FAIL', errCode: 'RANDOM_FAIL',
errMsg: '[预期内的报错]执行失败请重试' errMsg: '[预期内的报错]执行失败请重试'
} }
...@@ -27,6 +28,7 @@ module.exports = { ...@@ -27,6 +28,7 @@ module.exports = {
}, },
async fail() { async fail() {
return { return {
errSubject: 'fail',
errCode: 'TEST_ERROR_CODE', errCode: 'TEST_ERROR_CODE',
errMsg: '[预期内的报错]执行失败', errMsg: '[预期内的报错]执行失败',
tips: 'DO_NOT_TRY_AGAIN' tips: 'DO_NOT_TRY_AGAIN'
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册