未验证 提交 dcbec281 编写于 作者: O openharmony_ci 提交者: Gitee

!3514 misc上传写文件路径硬编码问题修复

Merge pull request !3514 from 高曦/OpenHarmony-3.1-Release
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index' import {describe, beforeAll, beforeEach, afterEach, afterAll, it, expect} from 'deccjsunit/index'
import request from '@ohos.request'; import request from '@ohos.request';
import * as pubfun from './Publicfunction.js' import * as pubfun from './Publicfunction.js'
import file from '@system.file';
var typeProgress = 'progress'; var typeProgress = 'progress';
var typeHeaderReceive = 'headerReceive'; var typeHeaderReceive = 'headerReceive';
...@@ -27,6 +28,17 @@ describe('UploadTest', function () { ...@@ -27,6 +28,17 @@ describe('UploadTest', function () {
beforeAll(function () { beforeAll(function () {
console.info('beforeAll: Prerequisites at the test suite level, ' + console.info('beforeAll: Prerequisites at the test suite level, ' +
'which are executed before the test suite is executed.'); 'which are executed before the test suite is executed.');
file.writeText({
uri: 'internal://cache/test.txt',
text: '1234567',
success: function() {
console.log('[Upload] <<UI>> call test.jpg writeText success.');
},
fail: function(data, code) {
console.error('Upload => call fail test.jpg fail, code: ' + code + ', data: ' + data);
},
});
}) })
beforeEach(function () { beforeEach(function () {
console.info('beforeEach: Prerequisites at the test case level,' + console.info('beforeEach: Prerequisites at the test case level,' +
...@@ -133,7 +145,7 @@ describe('UploadTest', function () { ...@@ -133,7 +145,7 @@ describe('UploadTest', function () {
try { try {
await pubfun.publicon(uploadTask, typeFail).then((data) => { await pubfun.publicon(uploadTask, typeFail).then((data) => {
console.log("SwitchOnFailCallback001 data " + data); console.log("SwitchOnFailCallback001 data " + data);
expect(5).assertEqual(data); expect(true).assertEqual(data != 0);
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("SwitchOnFailCallback001 fail 2" + JSON.stringify(err)); console.log("SwitchOnFailCallback001 fail 2" + JSON.stringify(err));
...@@ -160,7 +172,7 @@ describe('UploadTest', function () { ...@@ -160,7 +172,7 @@ describe('UploadTest', function () {
await pubfun.publicon(uploadTask, typeFail) await pubfun.publicon(uploadTask, typeFail)
await pubfun.publicoff(uploadTask, typeFail).then((data) => { await pubfun.publicoff(uploadTask, typeFail).then((data) => {
console.log("SwitchOffFailCallback001 data " + data); console.log("SwitchOffFailCallback001 data " + data);
expect(5).assertEqual(data); expect(true).assertEqual(data != 0);
done(); done();
}).catch((err) => { }).catch((err) => {
console.log("SwitchOffFailCallback001 fail 2" + JSON.stringify(err)); console.log("SwitchOffFailCallback001 fail 2" + JSON.stringify(err));
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册