提交 476b6ed3 编写于 作者: R raoxian

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

Signed-off-by: Nraoxian <raoxian@huawei.com>
上级 c9648c02
...@@ -295,45 +295,42 @@ describe('fileTest', function () { ...@@ -295,45 +295,42 @@ 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();
},
fail: function (data, code) {
console.info('File_writeText_002 call writeText fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
file.writeText({ file.writeText({
uri: 'internal://cache/File_writeText_002', uri: 'internal://cache/File_writeText_002',
text: 'Text2.', text: 'Text2.',
append: true, append: true,
success: function () { success: function () {
console.info('File_writeText_002 call writeText success.'); console.info('File_writeText_002 call writeText success.');
file.readText({
uri: 'internal://cache/File_writeText_002',
success: function (data) {
console.info('File_writeText_002 call read success. Content: ' );
file.delete({
uri: 'internal://cache/File_writeText_002',
success: function () {
console.info('File_writeText_002 call delete success');
done(); done();
}, },
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 delete 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) { fail: function (data, code) {
console.info('File_writeText_002 call read fail, code: ' + code + ', data: ' + data); console.info('File_writeText_002 call read fail, code: ' + code + ', data: ' + data);
expect(null).assertFail(); 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) { fail: function (data, code) {
console.info('File_writeText_002 call delete fail, code: ' + code + ', data: ' + data); console.info('File_writeText_002 call writeText 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(); expect(null).assertFail();
}, },
}); });
...@@ -865,39 +862,44 @@ describe('fileTest', function () { ...@@ -865,39 +862,44 @@ 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();
},
fail: function (data, code) {
console.info('File_writeArrayBuffer_005 , code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
file.writeArrayBuffer({ file.writeArrayBuffer({
uri: 'internal://cache/File_writeArrayBuffer_005', uri: 'internal://cache/File_writeArrayBuffer_005',
buffer: buf, buffer: buf,
position: 10, position: 10,
success: function () { success: function () {
console.info('File_writeArrayBuffer_005 call writeArrayBuffer success.'); console.info('File_writeArrayBuffer_005 call writeArrayBuffer success.');
file.readArrayBuffer({
uri: 'internal://cache/File_writeArrayBuffer_005',
success: function (data) {
console.info('File_writeArrayBuffer_005 read success:' );
file.delete({
uri: 'internal://cache/File_writeArrayBuffer_005',
success: function () {
console.info('File_writeArrayBuffer_005 call delete success');
done(); done();
}, },
fail: function (data, code) { fail: function (data, code) {
console.info('File_writeArrayBuffer_005 , code: ' + code + ', data: ' + data); console.info('File_writeArrayBuffer_005 delete fail, code: ' + code + ', data: ' + data);
expect(null).assertFail(); expect(null).assertFail();
}, },
}); });
file.readArrayBuffer({
uri: 'internal://cache/File_writeArrayBuffer_005',
success: function (data) {
console.info('File_writeArrayBuffer_005 read success:' );
done();
}, },
fail: function (data, code) { fail: function (data, code) {
console.info('File_writeArrayBuffer_005 , code: ' + code + ', data: ' + data); console.info('File_writeArrayBuffer_005 read fail, code: ' + code + ', data: ' + data);
expect(null).assertFail(); expect(null).assertFail();
}, },
}); });
file.delete({ },
uri: 'internal://cache/File_writeArrayBuffer_005' fail: function (data, code) {
console.info('File_writeArrayBuffer_005 writeArrayBuffer fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
},
fail: function (data, code) {
console.info('File_writeArrayBuffer_005 writeText fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
}); });
}); });
...@@ -2103,13 +2105,6 @@ describe('fileTest', function () { ...@@ -2103,13 +2105,6 @@ 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();
},
fail: function (data, code) {
console.info('File_rmdir_002 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
file.rmdir({ file.rmdir({
uri: 'internal://app/test', uri: 'internal://app/test',
recursive: false, recursive: false,
...@@ -2123,6 +2118,12 @@ describe('fileTest', function () { ...@@ -2123,6 +2118,12 @@ describe('fileTest', function () {
done(); done();
}, },
}); });
},
fail: function (data, code) {
console.info('File_rmdir_002 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
}); });
/** /**
...@@ -2136,46 +2137,43 @@ describe('fileTest', function () { ...@@ -2136,46 +2137,43 @@ 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();
},
fail: function (data, code) {
console.info('File_rmdir_003 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail();
},
});
file.mkdir({ file.mkdir({
uri: 'internal://cache/test/File_rmdir_003_1/File_rmdir_003_1/File_rmdir_003_2', uri: 'internal://cache/test/File_rmdir_003_1/File_rmdir_003_1/File_rmdir_003_2',
recursive: true, recursive: true,
success: function () { success: function () {
console.info('File_rmdir_003 mkdir success.'); 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',
recursive: true,
success: function () {
console.info('File_rmdir_003 mkdir success.');
file.rmdir({
uri: 'internal://cache/test',
recursive: true,
success: function () {
console.info('File_rmdir_003 call rmdir success.');
done(); done();
}, },
fail: function (data, code) {
console.info('File_rmdir_003 , 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.mkdir({
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.');
done();
}, },
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) { fail: function (data, code) {
console.info('File_rmdir_003 , code: ' + code + ', data: ' + data); console.info('File_rmdir_003 fail, code: ' + code + ', data: ' + data);
expect(null).assertFail(); 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.
先完成此消息的编辑!
想要评论请 注册