diff --git a/mailnews/compose/test/unit/test_splitRecipients.js b/mailnews/compose/test/unit/test_splitRecipients.js index e878c4f113..df6fb99a96 100644 --- a/mailnews/compose/test/unit/test_splitRecipients.js +++ b/mailnews/compose/test/unit/test_splitRecipients.js @@ -5,35 +5,90 @@ */ const splitRecipientsTests = - [ { recipients: "me@invalid.com", + [ { recipients: "me@foo.invalid", emailAddressOnly: false, count: 1, - result: [ "me@invalid.com" ] + result: [ "me@foo.invalid" ] }, - { recipients: "me@invalid.com, me2@invalid.com", + { recipients: "me@foo.invalid, me2@foo.invalid", emailAddressOnly: false, count: 2, - result: [ "me@invalid.com", "me2@invalid.com" ] + result: [ "me@foo.invalid", "me2@foo.invalid" ] }, - { recipients: '"foo bar" ', + { recipients: '"foo bar" ', emailAddressOnly: false, count: 1, - result: [ '"foo bar" ' ] + result: [ '"foo bar" ' ] }, - { recipients: '"foo bar" ', + { recipients: '"foo bar" ', emailAddressOnly: true, count: 1, - result: [ 'me@invalid.com' ] + result: [ 'me@foo.invalid' ] }, - { recipients: '"foo bar" , "bar foo" ', + { recipients: '"foo bar" , "bar foo" ', emailAddressOnly: false, count: 2, - result: [ '"foo bar" ', '"bar foo" ' ] + result: [ '"foo bar" ', '"bar foo" ' ] }, - { recipients: '"foo bar" , "bar foo" ', + { recipients: '"foo bar" , "bar foo" ', emailAddressOnly: true, count: 2, - result: [ "me@invalid.com", "me2@invalid.com" ] + result: [ "me@foo.invalid", "me2@foo.invalid" ] + }, + { recipients: "A Group:Ed Jones ,joe@where.invalid,John ;", + emailAddressOnly: false, + count: 3, + result: [ "Ed Jones ", "joe@where.invalid", "John " ] + }, + { recipients: 'mygroup:;, empty:;, foo@foo.invalid, othergroup:bar@foo.invalid, bar2@foo.invalid;, y@y.invalid, empty:;', + emailAddressOnly: true, + count: 4, + result: [ "foo@foo.invalid", "bar@foo.invalid", "bar2@foo.invalid", "y@y.invalid" ] + }, + { recipients: 'Undisclosed recipients:;;;;;;;;;;;;;;;;,,,,,,,,,,,,,,,,', + emailAddressOnly: true, + count: 0, + result: [] + }, + { recipients: 'a@xxx.invalid; b@xxx.invalid', + emailAddressOnly: true, + count: 2, + result: [ "a@xxx.invalid", "b@xxx.invalid" ] + }, + { recipients: 'a@xxx.invalid; B ', + emailAddressOnly: false, + count: 2, + result: [ "a@xxx.invalid", 'B ' ] + }, + { recipients: '"A " ; b@xxx.invalid', + emailAddressOnly: false, + count: 2, + result: [ '"A " ', "b@xxx.invalid" ] + }, + { recipients: 'A ; B ', + emailAddressOnly: false, + count: 2, + result: [ "A ", 'B ' ] + }, + { recipients: "A (this: is, a comment;) ; g: (this: is, comment;) C , d.invalid;", + emailAddressOnly: false, + count: 3, + result: [ '"A (this: is, a comment;)" ', '"(this: is, comment;) C" ', "d.invalid" ] + }, + { recipients: 'Mary Smith , extra:;, group:jdoe@example.invalid; Who? ; , "Giant; \"Big\" Box" , ', + emailAddressOnly: false, + count: 5, + result: [ "Mary Smith ", "jdoe@example.invalid", "Who? ", "boss@nil.invalid", '"Giant; \"Big\" Box" ' ] + }, + { recipients: 'Undisclosed recipients: a@foo.invalid ;;extra:;', + emailAddressOnly: true, + count: 1, + result: [ 'a@foo.invalid' ] + }, + { recipients: 'Undisclosed recipients:;;extra:a@foo.invalid;', + emailAddressOnly: true, + count: 1, + result: [ 'a@foo.invalid' ] }, { recipients: "", emailAddressOnly: false,