2018-09-25 10:22:19 -07:00
|
|
|
const emailAddress = 'nowhere@example.com';
|
|
|
|
const cc = 'nowhere1@example.com';
|
|
|
|
const bcc = 'nowhere-bcc@example.com';
|
|
|
|
const body = 'Message';
|
|
|
|
const subject = 'Email';
|
|
|
|
const base = 'mailto:';
|
2018-09-26 22:20:23 -07:00
|
|
|
const mailToEmail = `${base}${encodeURIComponent(emailAddress)}`;
|
2020-08-26 15:44:50 -07:00
|
|
|
|
|
|
|
export const emailMailToAsserts = [
|
2018-09-25 10:22:19 -07:00
|
|
|
{
|
2018-09-26 21:57:16 -07:00
|
|
|
expected: base,
|
|
|
|
args: void 0,
|
|
|
|
assertMsg: 'it should return a basic mailto: string without an email when no arguments are passed'
|
2018-09-25 10:22:19 -07:00
|
|
|
},
|
|
|
|
{
|
2018-09-26 21:57:16 -07:00
|
|
|
expected: base,
|
|
|
|
args: {},
|
|
|
|
assertMsg: 'it should return a basic mailto: string without an email when an empty object is passed'
|
2018-09-25 10:22:19 -07:00
|
|
|
},
|
|
|
|
{
|
2018-09-26 21:57:16 -07:00
|
|
|
expected: base,
|
|
|
|
args: { to: '' },
|
|
|
|
assertMsg:
|
2018-09-25 10:22:19 -07:00
|
|
|
'it should return a basic mailto: string without an email when an object with only an empty string in the `to` field is passed'
|
|
|
|
},
|
|
|
|
{
|
2018-09-26 21:57:16 -07:00
|
|
|
expected: `${mailToEmail}`,
|
|
|
|
args: { to: emailAddress },
|
|
|
|
assertMsg: 'it should return a mailto: string with an email when an object with only the `to` field is passed'
|
2018-09-25 10:22:19 -07:00
|
|
|
},
|
|
|
|
{
|
2018-09-26 22:20:23 -07:00
|
|
|
expected: `${mailToEmail}?cc=${encodeURIComponent(cc)}`,
|
2018-09-26 21:57:16 -07:00
|
|
|
args: { to: emailAddress, cc },
|
|
|
|
assertMsg: 'it should return a mailto: string with an email and a cc query when to and cc are passed in'
|
2018-09-25 10:22:19 -07:00
|
|
|
},
|
|
|
|
{
|
2018-09-26 22:20:23 -07:00
|
|
|
expected: `${mailToEmail}?cc=${encodeURIComponent(cc)}&subject=${encodeURIComponent(subject)}`,
|
2018-09-26 21:57:16 -07:00
|
|
|
args: { to: emailAddress, cc, subject },
|
|
|
|
assertMsg:
|
2018-09-25 10:22:19 -07:00
|
|
|
'it should return a mailto: string with an email, subject, and a cc query when to, subject, and cc are passed in'
|
|
|
|
},
|
|
|
|
{
|
2018-09-26 22:20:23 -07:00
|
|
|
expected: `${mailToEmail}?cc=${encodeURIComponent(cc)}&subject=${encodeURIComponent(
|
|
|
|
subject
|
|
|
|
)}&bcc=${encodeURIComponent(bcc)}`,
|
2018-09-26 21:57:16 -07:00
|
|
|
args: { to: emailAddress, cc, subject, bcc },
|
|
|
|
assertMsg:
|
2018-09-25 10:22:19 -07:00
|
|
|
'it should return a mailto: string with an email, subject, bcc, and a cc query when to, subject, bcc, and cc are passed in'
|
|
|
|
},
|
|
|
|
{
|
2018-09-26 22:20:23 -07:00
|
|
|
expected: `${mailToEmail}?cc=${encodeURIComponent(cc)}&subject=${encodeURIComponent(
|
|
|
|
subject
|
|
|
|
)}&bcc=${encodeURIComponent(bcc)}&body=${encodeURIComponent(body)}`,
|
2018-09-26 21:57:16 -07:00
|
|
|
args: { to: emailAddress, cc, subject, bcc, body },
|
|
|
|
assertMsg:
|
2018-09-25 10:22:19 -07:00
|
|
|
'it should return a mailto: string with an email, subject, bcc, body, and a cc query when to, subject, bcc, body, and cc are passed in'
|
|
|
|
}
|
|
|
|
];
|