Bug 1218721 - Part 2 - Improve Test Coverage. r=echen

This commit is contained in:
Bevis Tseng 2015-10-30 20:24:02 +08:00
parent 50dda7a56e
commit 344fbfabb5
3 changed files with 16 additions and 16 deletions

View File

@ -30,6 +30,14 @@ var TEST_ADD_DATA = [{
name: ["add6"],
tel: [{value: "01234567890123456789"}, {value: "123456"}, {value: "123"}],
email:[{value: "test@mozilla.com"}],
}, {
// a contact without number.
name: ["add7"],
tel: [{value: ""}],
}, {
// a contact without name.
name: [""],
tel: [{value: "0987654321"}],
}];
function testAddContact(aIcc, aType, aMozContact, aPin2) {

View File

@ -25,7 +25,7 @@ const TEST_UPDATE_DATA = [{
name: ["Fire 火"],
tel: [{value: ""}]},
expect: {
number: null}
number: ""}
}, {
id: 5,
data: {
@ -52,12 +52,8 @@ function testUpdateContact(aIcc, aType, aContactId, aMozContact, aExpect, aPin2)
return aIcc.updateContact(aType, contact, aPin2)
.then((aResult) => {
if (aExpect.number === null) {
is(aResult.tel, null);
} else {
is(aResult.tel[0].value, aExpect.number);
ok(aResult.tel.length == 1);
}
is(aResult.tel[0].value, aExpect.number);
ok(aResult.tel.length == 1);
// We only support SIM in emulator, so we don't have anr and email field.
ok(!aResult.email);
is(contact.id, aIcc.iccInfo.iccid + aContactId);
@ -101,11 +97,7 @@ function testUpdateContacts(aIcc, aType, aCacheContacts, aPin2) {
is(contact.name[0], expectedResult.data.name[0]);
is(contact.id, aIcc.iccInfo.iccid + expectedResult.id);
if (expectedResult.expect.number === null) {
is(contact.tel, null);
} else {
is(contact.tel[0].value, expectedResult.expect.number);
}
is(contact.tel[0].value, expectedResult.expect.number);
}
return revertContacts(aIcc, aCacheContacts, aType, aPin2);
});

View File

@ -367,7 +367,7 @@ add_test(function test_write_alpha_identifier() {
// Removal
let writenAlphaId = iccHelper.writeAlphaIdentifier(10, null);
equal(writenAlphaId, null);
equal(writenAlphaId, "");
equal(iccHelper.readAlphaIdentifier(10), "");
// GSM 8 bit
@ -401,7 +401,7 @@ add_test(function test_write_alpha_identifier() {
// Write 0 octet.
writenAlphaId = iccHelper.writeAlphaIdentifier(0, "1");
helper.writeHexOctet(0xff); // dummy octet.
equal(writenAlphaId, null);
equal(writenAlphaId, "");
equal(iccHelper.readAlphaIdentifier(1), "");
run_next_test();
@ -490,8 +490,8 @@ add_test(function test_write_alpha_id_dialling_number() {
writtenContact = helper.writeAlphaIdDiallingNumber(recordSize);
contactR = helper.readAlphaIdDiallingNumber(recordSize);
equal(contactR, null);
equal(writtenContact.alphaId, null);
equal(writtenContact.number, null);
equal(writtenContact.alphaId, "");
equal(writtenContact.number, "");
// Write a longer alphaId/dialling number
// Dialling Number : Maximum 20 digits(10 octets).