diff --git a/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js b/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js index fa6fdfe9e139bebe713f22243af14e926cb8e03e..252c0bf10f6475e68e3a33404f698b5cfb4d893e 100644 --- a/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js +++ b/communication/dsoftbus/rpc/src/main/js/test/RpcClientJsunit.test.js @@ -3959,7 +3959,7 @@ export default function actsRpcClientJsTest() { let a = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"), new MySequenceable(3, "ccc")] data.writeParcelableArray(a); - await gIRemoteObject.sendMessageRequest(CODE_ALL_ARRAY_TYPE, data, reply, option,(err, result) => { + await gIRemoteObject.sendMessageRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => { expect(result.errCode).assertEqual(0); assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]); assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]); @@ -4015,15 +4015,33 @@ export default function actsRpcClientJsTest() { data.writeParcelableArray(a); await gIRemoteObject.sendMessageRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => { expect(result.errCode).assertEqual(0); - assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]); - assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]); - assertArrayElementEqual(result.reply.readIntArray(), [7, 8, 9]); - assertArrayElementEqual(result.reply.readLongArray(), [10, 11, 12]); - assertArrayElementEqual(result.reply.readFloatArray(), [1.1, 1.2, 1.3]); - assertArrayElementEqual(result.reply.readDoubleArray(), [2.1, 2.2, 2.3]); - assertArrayElementEqual(result.reply.readBooleanArray(), [true, true, false]); - assertArrayElementEqual(result.reply.readCharArray(), [65,97,122]); - assertArrayElementEqual(result.reply.readStringArray(), ['abc', 'seggg']); + let ByteArray = new Array(); + result.reply.readByteArray(ByteArray) + assertArrayElementEqual(ByteArray, [1, 2, 3]); + let ShortArray = new Array(); + result.reply.readShortArray(ShortArray) + assertArrayElementEqual(ShortArray, [4, 5, 6]); + let IntArray = new Array(); + result.reply.readIntArray(IntArray) + assertArrayElementEqual(IntArray, [7, 8, 9]); + let LongArray = new Array(); + result.reply.readLongArray(LongArray) + assertArrayElementEqual(LongArray, [10, 11, 12]); + let FloatArray = new Array(); + result.reply.readFloatArray(FloatArray) + assertArrayElementEqual(FloatArray, [1.1, 1.2, 1.3]); + let DoubleArray = new Array(); + result.reply.readDoubleArray(DoubleArray) + assertArrayElementEqual(DoubleArray, [2.1, 2.2, 2.3]); + let BooleanArray = new Array(); + result.reply.readBooleanArray(BooleanArray) + assertArrayElementEqual(BooleanArray, [true, true, false]); + let CharArray = new Array(); + result.reply.readCharArray(CharArray) + assertArrayElementEqual(CharArray, [65,97,122]); + let StringArray = new Array(); + result.reply.readStringArray(StringArray); + assertArrayElementEqual(StringArray, ['abc', 'seggg']); let b = [new MySequenceable(null, null), new MySequenceable(null, null), new MySequenceable(null, null)]; result.reply.readParcelableArray(b); @@ -9533,7 +9551,7 @@ export default function actsRpcClientJsTest() { let a = [new MySequenceable(1, "aaa"), new MySequenceable(2, "bbb"), new MySequenceable(3, "ccc")]; expect(data.writeSequenceableArray(a)).assertTrue(); - gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option,(err, result) => { + gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => { expect(result.errCode).assertEqual(0); assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]); assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]); @@ -9593,15 +9611,33 @@ export default function actsRpcClientJsTest() { expect(data.writeSequenceableArray(a)).assertTrue(); gIRemoteObject.sendRequest(CODE_ALL_ARRAY_TYPE, data, reply, option).then((result) => { expect(result.errCode).assertEqual(0); - assertArrayElementEqual(result.reply.readByteArray(), [1, 2, 3]); - assertArrayElementEqual(result.reply.readShortArray(), [4, 5, 6]); - assertArrayElementEqual(result.reply.readIntArray(), [7, 8, 9]); - assertArrayElementEqual(result.reply.readLongArray(), [10, 11, 12]); - assertArrayElementEqual(result.reply.readFloatArray(), [1.1, 1.2, 1.3]); - assertArrayElementEqual(result.reply.readDoubleArray(), [2.1, 2.2, 2.3]); - assertArrayElementEqual(result.reply.readBooleanArray(), [true, true, false]); - assertArrayElementEqual(result.reply.readCharArray(), [10, 20, 30]); - assertArrayElementEqual(result.reply.readStringArray(), ['abc', 'seggg']); + let ByteArray = new Array(); + result.reply.readByteArray(ByteArray) + assertArrayElementEqual(ByteArray, [1, 2, 3]); + let ShortArray = new Array(); + result.reply.readShortArray(ShortArray) + assertArrayElementEqual(ShortArray, [4, 5, 6]); + let IntArray = new Array(); + result.reply.readIntArray(IntArray) + assertArrayElementEqual(IntArray, [7, 8, 9]); + let LongArray = new Array(); + result.reply.readLongArray(LongArray) + assertArrayElementEqual(LongArray, [10, 11, 12]); + let FloatArray = new Array(); + result.reply.readFloatArray(FloatArray) + assertArrayElementEqual(FloatArray, [1.1, 1.2, 1.3]); + let DoubleArray = new Array(); + result.reply.readDoubleArray(DoubleArray) + assertArrayElementEqual(DoubleArray, [2.1, 2.2, 2.3]); + let BooleanArray = new Array(); + result.reply.readBooleanArray(BooleanArray) + assertArrayElementEqual(BooleanArray, [true, true, false]); + let CharArray = new Array(); + result.reply.readCharArray(CharArray) + assertArrayElementEqual(CharArray, [65,97,122]); + let StringArray = new Array(); + result.reply.readStringArray(StringArray); + assertArrayElementEqual(StringArray, ['abc', 'seggg']); let b = [new MySequenceable(null, null), new MySequenceable(null, null), new MySequenceable(null, null)]; result.reply.readSequenceableArray(b); @@ -13206,7 +13242,7 @@ export default function actsRpcClientJsTest() { data.writeString("HelloWorld"); data.writeParcelable(new MySequenceable(1, "aaa")); - await gIRemoteObject.sendMessageRequest(CODE_ALL_TYPE, data, reply, option, (err, result) => { + await gIRemoteObject.sendMessageRequest(CODE_ALL_TYPE, data, reply, option).then((result) => { console.info("SUB_Softbus_IPC_Compatibility_IRemoteObject_00900 errorcode: " + result.errCode); expect(result.errCode).assertEqual(0); expect(result.reply.readByte()).assertEqual(1);