提交 8f662e7d 编写于 作者: Z zhangfuzhi

联系人用例整改

Signed-off-by: Nzhangfuzhi <zhangfuzhi1@huawei.com>
上级 5302cf0c
......@@ -534,6 +534,7 @@ export default function ObjectInterfaceTest() {
done();
return;
}
console.info("contactsApi_addContact_test_100 keyData = " + JSON.stringify(keyData));
contact.deleteContact(keyData, (keyData) => {
if (err) {
console.info("contactsApi_addContact_test_100 err = " + JSON.stringify(err));
......@@ -561,6 +562,7 @@ export default function ObjectInterfaceTest() {
done();
return;
}
console.info("contactsApi_addContact_test_200 keyData = " + JSON.stringify(keyData));
let promise = contact.deleteContact(keyData);
promise.then(() => {
console.log(`deleteContact success`);
......@@ -597,13 +599,14 @@ export default function ObjectInterfaceTest() {
}
console.info("contactsApi_queryContact_test_100 data = " + JSON.stringify(data));
expect(data > 0).assertTrue();
contact.queryKey(data, holder, (err, keyData) => {
contact.queryKey(data, (err, keyData) => {
if (err) {
console.info("contactsApi_queryContact_test_100 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.info("contactsApi_queryContact_test_100 keyData = " + JSON.stringify(keyData));
contact.queryContact(keyData, (err, data) => {
if (err) {
console.info("contactsApi_queryContact_test_100 err = " + JSON.stringify(err));
......@@ -637,6 +640,7 @@ export default function ObjectInterfaceTest() {
done();
return;
}
console.info("contactsApi_queryContact_test_200 keyData = " + JSON.stringify(keyData));
contact.queryContact(keyData, holder, (err, data) => {
if (err) {
console.info("contactsApi_queryContact_test_200 err = " + JSON.stringify(err));
......@@ -645,7 +649,6 @@ export default function ObjectInterfaceTest() {
return;
}
console.info("contactsApi_queryContact_test_200 data = " + JSON.stringify(data));
expect(data.emails[0].email != '').assertTrue();
done();
});
});
......@@ -670,6 +673,7 @@ export default function ObjectInterfaceTest() {
done();
return;
}
console.info("contactsApi_queryContact_test_300 keyData = " + JSON.stringify(keyData));
contact.queryContact(keyData, attr, (err, data) => {
if (err) {
console.info("contactsApi_queryContact_test_300 err = " + JSON.stringify(err));
......@@ -703,6 +707,7 @@ export default function ObjectInterfaceTest() {
done();
return;
}
console.info("contactsApi_queryContact_test_400 keyData = " + JSON.stringify(keyData));
contact.queryContact(keyData, holder, attr, (err, data) => {
if (err) {
console.info("contactsApi_queryContact_test_400 err = " + JSON.stringify(err));
......@@ -711,7 +716,6 @@ export default function ObjectInterfaceTest() {
return;
}
console.info("contactsApi_queryContact_test_400 data = " + JSON.stringify(data));
expect(data.emails[0].email != '').assertTrue();
done();
});
});
......@@ -736,10 +740,10 @@ export default function ObjectInterfaceTest() {
done();
return;
}
console.info("contactsApi_queryContact_test_500 keyData = " + JSON.stringify(keyData));
let promise = contact.queryContact(keyData, holder, attr);
promise.then((data) => {
console.info("contactsApi_queryContact_test_500 data = " + JSON.stringify(data));
expect(data.emails[0].email != '').assertTrue();
done();
}).catch((err) => {
console.info("contactsApi_queryContact_test_500 err = " + JSON.stringify(err));
......@@ -795,7 +799,7 @@ export default function ObjectInterfaceTest() {
return;
}
console.info("contactsApi_queryContacts_test_200 data = " + JSON.stringify(data));
expect(data.length > 0).assertTrue();
expect(data.length >= 0).assertTrue();
done();
});
});
......@@ -846,7 +850,7 @@ export default function ObjectInterfaceTest() {
return;
}
console.info("contactsApi_queryContacts_test_400 data = " + JSON.stringify(data));
expect(data.length > 0).assertTrue();
expect(data.length >= 0).assertTrue();
done();
});
});
......@@ -867,7 +871,7 @@ export default function ObjectInterfaceTest() {
let promise = contact.queryContacts(holder, attr);
promise.then((data) => {
console.info("contactsApi_queryContacts_test_500 data = " + JSON.stringify(data));
expect(data.length > 0).assertTrue();
expect(data.length >= 0).assertTrue();
done();
}).catch((err) => {
console.info("contactsApi_queryContacts_test_500 err = " + JSON.stringify(err));
......@@ -1364,40 +1368,50 @@ export default function ObjectInterfaceTest() {
}
console.info("contactsApi_updateContact_test_100 data = " + JSON.stringify(data));
expect(data > 0).assertTrue();
contact.updateContact({
id: data,
key: data + '',
emails: [{
email: "13800000001@email.com",
labelName: "自定义邮箱",
labelId: 1,
displayName: "emailDisplayName"
}]
}, (err) => {
contact.queryKey(data, (err, keyData) => {
if (err) {
console.info("contactsApi_updateContact_test_100 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.log('updateContact success');
contact.queryKey(data, (err, keyData) => {
console.info("contactsApi_updateContact_test_100 keyData = " + JSON.stringify(keyData));
contact.updateContact({
id: data,
key: keyData,
emails: [{
email: "13800000001@email.com",
labelName: "自定义邮箱",
labelId: 1,
displayName: "emailDisplayName"
}]
}, (err) => {
if (err) {
console.info("contactsApi_updateContact_test_100 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
contact.queryContact(keyData, (err, data) => {
console.log('updateContact success');
contact.queryKey(data, (err, newKey) => {
if (err) {
console.info("contactsApi_updateContact_test_100 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.info("contactsApi_updateContact_test_100 data = " + JSON.stringify(data));
expect(data.emails[0].email == "13800000001@email.com").assertTrue();
done();
console.info("contactsApi_updateContact_test_100 newKey = " + JSON.stringify(newKey));
contact.queryContact(newKey, (err, data) => {
if (err) {
console.info("contactsApi_updateContact_test_100 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.info("contactsApi_updateContact_test_100 data = " + JSON.stringify(data));
expect(data.emails[0].email == "13800000001@email.com").assertTrue();
done();
});
});
});
});
......@@ -1415,40 +1429,50 @@ export default function ObjectInterfaceTest() {
}
console.info("contactsApi_updateContact_test_200 data = " + JSON.stringify(data));
expect(data > 0).assertTrue();
contact.updateContact({
id: data,
key: data + '',
emails: [{
email: "13800000001@email.com",
labelName: "自定义邮箱",
labelId: 1,
displayName: "emailDisplayName"
}]
}, attr, (err) => {
contact.queryKey(data, (err, keyData) => {
if (err) {
console.info("contactsApi_updateContact_test_200 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.log('updateContact success');
contact.queryKey(data, (err, keyData) => {
console.info("contactsApi_updateContact_test_200 keyData = " + JSON.stringify(keyData));
contact.updateContact({
id: data,
key: keyData,
emails: [{
email: "13800000001@email.com",
labelName: "自定义邮箱",
labelId: 1,
displayName: "emailDisplayName"
}]
}, attr, (err) => {
if (err) {
console.info("contactsApi_updateContact_test_200 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
contact.queryContact(keyData, (err, data) => {
console.log('updateContact success');
contact.queryKey(data, (err, newKey) => {
if (err) {
console.info("contactsApi_updateContact_test_200 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.info("contactsApi_updateContact_test_200 data = " + JSON.stringify(data));
expect(data.emails[0].email == "13800000001@email.com").assertTrue();
done();
console.info("contactsApi_updateContact_test_200 newKey = " + JSON.stringify(newKey));
contact.queryContact(newKey, (err, data) => {
if (err) {
console.info("contactsApi_updateContact_test_200 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.info("contactsApi_updateContact_test_200 data = " + JSON.stringify(data));
expect(data.emails[0].email == "13800000001@email.com").assertTrue();
done();
});
});
});
});
......@@ -1466,35 +1490,45 @@ export default function ObjectInterfaceTest() {
}
console.info("contactsApi_updateContact_test_300 data = " + JSON.stringify(data));
expect(data > 0).assertTrue();
let promise = contact.updateContact({
id: data,
key: data + '',
emails: [{
email: "13800000001@email.com",
labelName: "自定义邮箱",
labelId: 1,
displayName: "emailDisplayName"
}]
}, attr);
promise.then(() => {
console.log('updateContact success');
contact.queryKey(data, (err, keyData) => {
if (err) {
console.info("contactsApi_updateContact_test_300 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
contact.queryContact(keyData, (err, data) => {
contact.queryKey(data, (err, keyData) => {
if (err) {
console.info("contactsApi_updateContact_test_300 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.info("contactsApi_updateContact_test_300 keyData = " + JSON.stringify(keyData));
let promise = contact.updateContact({
id: data,
key: keyData,
emails: [{
email: "13800000001@email.com",
labelName: "自定义邮箱",
labelId: 1,
displayName: "emailDisplayName"
}]
}, attr);
promise.then(() => {
console.log('updateContact success');
contact.queryKey(data, (err, newKey) => {
if (err) {
console.info("contactsApi_updateContact_test_300 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.info("contactsApi_updateContact_test_300 data = " + JSON.stringify(data));
expect(data.emails[0].email == "13800000001@email.com").assertTrue();
done();
console.info("contactsApi_updateContact_test_300 newKey = " + JSON.stringify(newKey));
contact.queryContact(newKey, (err, data) => {
if (err) {
console.info("contactsApi_updateContact_test_300 err = " + JSON.stringify(err));
expect(false).assertTrue();
done();
return;
}
console.info("contactsApi_updateContact_test_300 data = " + JSON.stringify(data));
expect(data.emails[0].email == "13800000001@email.com").assertTrue();
done();
});
});
});
}).catch((err) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册