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

!5026 修改File.test.js黄区测试问题

Merge pull request !5026 from raoxian/master
...@@ -295,48 +295,45 @@ describe('fileTest', function () { ...@@ -295,48 +295,45 @@ describe('fileTest', function () {
text: 'Text1.', text: 'Text1.',
success: function () { success: function () {
console.info('File_writeText_002 call writeText success.'); console.info('File_writeText_002 call writeText success.');
done(); file.writeText({
}, uri: 'internal://cache/File_writeText_002',
fail: function (data, code) { text: 'Text2.',
console.info('File_writeText_002 call writeText fail, code: ' + code + ', data: ' + data); append: true,
expect(null).assertFail(); success: function () {
}, console.info('File_writeText_002 call writeText success.');
}); file.readText({
file.writeText({ uri: 'internal://cache/File_writeText_002',
uri: 'internal://cache/File_writeText_002', success: function (data) {
text: 'Text2.', console.info('File_writeText_002 call read success. Content: ' );
append: true, file.delete({
success: function () { uri: 'internal://cache/File_writeText_002',
console.info('File_writeText_002 call writeText success.'); success: function () {
done(); console.info('File_writeText_002 call delete success');
done();
},
fail: function (data, code) {
console.info('File_writeText_002 call delete fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
},
fail: function (data, code) {
console.info('File_writeText_002 call read fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
},
fail: function (data, code) {
console.info('File_writeText_002 call writeText fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
}, },
fail: function (data, code) { fail: function (data, code) {
console.info('File_writeText_002 call writeText fail, code: ' + code + ', data: ' + data); console.info('File_writeText_002 call writeText fail, code: ' + code + ', data: ' + data);
expect(null).assertFail(); expect(null).assertFail();
}, },
}); });
file.readText({
uri: 'internal://cache/File_writeText_002',
success: function (data) {
console.info('File_writeText_002 call read success. Content: ' );
done();
},
fail: function (data, code) {
console.info('File_writeText_002 call read fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
file.delete({
uri: 'internal://cache/File_writeText_002',
success: function () {
console.info('File_writeText_002 call delete success');
done();
},
fail: function (data, code) {
console.info('File_writeText_002 call delete fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
}); });
/** /**
...@@ -865,40 +862,45 @@ describe('fileTest', function () { ...@@ -865,40 +862,45 @@ describe('fileTest', function () {
buffer: buf, buffer: buf,
success: function () { success: function () {
console.info('File_writeArrayBuffer_005 call writeText success.'); console.info('File_writeArrayBuffer_005 call writeText success.');
done(); file.writeArrayBuffer({
}, uri: 'internal://cache/File_writeArrayBuffer_005',
fail: function (data, code) { buffer: buf,
console.info('File_writeArrayBuffer_005 , code: ' + code + ', data: ' + data); position: 10,
expect(null).assertFail(); success: function () {
}, console.info('File_writeArrayBuffer_005 call writeArrayBuffer success.');
}); file.readArrayBuffer({
file.writeArrayBuffer({ uri: 'internal://cache/File_writeArrayBuffer_005',
uri: 'internal://cache/File_writeArrayBuffer_005', success: function (data) {
buffer: buf, console.info('File_writeArrayBuffer_005 read success:' );
position: 10, file.delete({
success: function () { uri: 'internal://cache/File_writeArrayBuffer_005',
console.info('File_writeArrayBuffer_005 call writeArrayBuffer success.'); success: function () {
done(); console.info('File_writeArrayBuffer_005 call delete success');
}, done();
fail: function (data, code) { },
console.info('File_writeArrayBuffer_005 , code: ' + code + ', data: ' + data); fail: function (data, code) {
expect(null).assertFail(); console.info('File_writeArrayBuffer_005 delete fail, code: ' + code + ', data: ' + data);
}, expect(null).assertFail();
}); },
file.readArrayBuffer({ });
uri: 'internal://cache/File_writeArrayBuffer_005', },
success: function (data) { fail: function (data, code) {
console.info('File_writeArrayBuffer_005 read success:' ); console.info('File_writeArrayBuffer_005 read fail, code: ' + code + ', data: ' + data);
done(); expect(null).assertFail();
},
});
},
fail: function (data, code) {
console.info('File_writeArrayBuffer_005 writeArrayBuffer fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
}, },
fail: function (data, code) { fail: function (data, code) {
console.info('File_writeArrayBuffer_005 , code: ' + code + ', data: ' + data); console.info('File_writeArrayBuffer_005 writeText fail, code: ' + code + ', data: ' + data);
expect(null).assertFail(); expect(null).assertFail();
}, },
}); });
file.delete({
uri: 'internal://cache/File_writeArrayBuffer_005'
});
}); });
/** /**
...@@ -2103,26 +2105,25 @@ describe('fileTest', function () { ...@@ -2103,26 +2105,25 @@ describe('fileTest', function () {
recursive: true, recursive: true,
success: function () { success: function () {
console.info('File_rmdir_002 mkdir success.'); console.info('File_rmdir_002 mkdir success.');
done(); file.rmdir({
uri: 'internal://app/test',
recursive: false,
success: function () {
console.info('File_rmdir_002 call rmdir success.');
expect(null).assertFail();
},
fail: function (data, code) {
console.info('File_rmdir_002 fail, code: ' + code + ', data: ' + data);
expect(code == 301 || code == 300).assertTrue();
done();
},
});
}, },
fail: function (data, code) { fail: function (data, code) {
console.info('File_rmdir_002 fail, code: ' + code + ', data: ' + data); console.info('File_rmdir_002 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail(); expect(null).assertFail();
}, },
}); });
file.rmdir({
uri: 'internal://app/test',
recursive: false,
success: function () {
console.info('File_rmdir_002 call rmdir success.');
expect(null).assertFail();
},
fail: function (data, code) {
console.info('File_rmdir_002 fail, code: ' + code + ', data: ' + data);
expect(code == 301 || code == 300).assertTrue();
done();
},
});
}); });
/** /**
...@@ -2136,49 +2137,46 @@ describe('fileTest', function () { ...@@ -2136,49 +2137,46 @@ describe('fileTest', function () {
recursive: true, recursive: true,
success: function () { success: function () {
console.info('File_rmdir_003 mkdir success.'); console.info('File_rmdir_003 mkdir success.');
done(); file.mkdir({
}, uri: 'internal://cache/test/File_rmdir_003_1/File_rmdir_003_1/File_rmdir_003_2',
fail: function (data, code) { recursive: true,
console.info('File_rmdir_003 fail, code: ' + code + ', data: ' + data); success: function () {
expect(null).assertFail(); console.info('File_rmdir_003 mkdir success.');
}, file.mkdir({
}); uri: 'internal://cache/test/File_rmdir_003_2/File_rmdir_003_1/File_rmdir_003_2',
file.mkdir({ recursive: true,
uri: 'internal://cache/test/File_rmdir_003_1/File_rmdir_003_1/File_rmdir_003_2', success: function () {
recursive: true, console.info('File_rmdir_003 mkdir success.');
success: function () { file.rmdir({
console.info('File_rmdir_003 mkdir success.'); uri: 'internal://cache/test',
done(); recursive: true,
}, success: function () {
fail: function (data, code) { console.info('File_rmdir_003 call rmdir success.');
console.info('File_rmdir_003 fail, code: ' + code + ', data: ' + data); done();
expect(null).assertFail(); },
}, fail: function (data, code) {
}); console.info('File_rmdir_003 , code: ' + code + ', data: ' + data);
file.mkdir({ expect(null).assertFail();
uri: 'internal://cache/test/File_rmdir_003_2/File_rmdir_003_1/File_rmdir_003_2', },
recursive: true, });
success: function () { },
console.info('File_rmdir_003 mkdir success.'); fail: function (data, code) {
done(); console.info('File_rmdir_003 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
},
fail: function (data, code) {
console.info('File_rmdir_003 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
}, },
fail: function (data, code) { fail: function (data, code) {
console.info('File_rmdir_003 fail, code: ' + code + ', data: ' + data); console.info('File_rmdir_003 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail(); expect(null).assertFail();
}, },
}); });
file.rmdir({
uri: 'internal://cache/test',
recursive: true,
success: function () {
console.info('File_rmdir_003 call rmdir success.');
done();
},
fail: function (data, code) {
console.info('File_rmdir_003 , code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
}); });
/** /**
...@@ -2208,13 +2206,13 @@ describe('fileTest', function () { ...@@ -2208,13 +2206,13 @@ describe('fileTest', function () {
*/ */
it('File_rmdir_005', 0, async function (done) { it('File_rmdir_005', 0, async function (done) {
file.rmdir({ file.rmdir({
uri: 'internal://app/notdir/123', uri: 'internal://app/123',
success: function () { success: function () {
console.info('File_rmdir_005 call rmdir success.'); console.info('File_rmdir_005 call rmdir success.');
expect(null).assertFail(); expect(null).assertFail();
}, },
fail: function (data, code) { fail: function (data, code) {
console.info('File_rmdir_005 , code: ' + code + ', data: ' + data); console.info('File_rmdir_005 rmdir fail, code: ' + code + ', data: ' + data);
expect(code == 301).assertTrue(); expect(code == 301).assertTrue();
done(); done();
}, },
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册