Invalid email spec

master
Mark Moffat 2019-11-16 12:53:25 +10:30
parent 12c2a4d4e2
commit 5b3ee2a734
1 changed files with 22 additions and 0 deletions

View File

@ -53,6 +53,28 @@ test('[Fail] Try create a duplicate customer', async t => {
t.deepEqual(res.body.err, 'A customer already exists with that email address'); t.deepEqual(res.body.err, 'A customer already exists with that email address');
}); });
test('[Fail] Try invalid email address', async t => {
const customer = {
email: 'sarah.jones@test',
firstName: 'Sarah',
lastName: 'Jones',
address1: '1 Sydney Street',
address2: '',
country: 'Australia',
state: 'NSW',
postcode: '2000',
phone: '0400000000',
password: 'password'
};
const res = await g.request
.post('/customer/create')
.send(customer)
.expect(400);
t.deepEqual(res.body[0].message, 'should match format "emailAddress"');
});
test('[Success] Get customer list', async t => { test('[Success] Get customer list', async t => {
const res = await g.request const res = await g.request
.get('/admin/customers') .get('/admin/customers')