From 5b3ee2a734e88a034ecff97c3e62d4dce91a3d72 Mon Sep 17 00:00:00 2001 From: Mark Moffat Date: Sat, 16 Nov 2019 12:53:25 +1030 Subject: [PATCH] Invalid email spec --- test/specs/customers.js | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/test/specs/customers.js b/test/specs/customers.js index 2eab2ec..c1ff5d6 100644 --- a/test/specs/customers.js +++ b/test/specs/customers.js @@ -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'); }); +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 => { const res = await g.request .get('/admin/customers')