diff --git a/__tests__/functions/databases/postgresql/create.js b/__tests__/functions/databases/postgresql/create.js index 57ed641..4d1fb2d 100644 --- a/__tests__/functions/databases/postgresql/create.js +++ b/__tests__/functions/databases/postgresql/create.js @@ -13,3 +13,26 @@ // // describe("Tests for Postgres Send", () => { // // }); + +describe('tests the pg create method', () => { + class FakeClient { + constructor() { + this.pgConnect = function () { + return new Promise((resolve, reject) => { + resolve({ + query: (query, values) => new Promise((resolve, reject) => { + resolve('fakeUser'); + }), + }); + }); + }; + } + this.client = { + verify: { + services: { + create: ({}) + } + } + } + } +}); diff --git a/functions/databases/postgres/create.js b/functions/databases/postgres/create.js index 4dea816..8d1c428 100644 --- a/functions/databases/postgres/create.js +++ b/functions/databases/postgres/create.js @@ -7,9 +7,11 @@ module.exports = function (userID, phone) { this.pgConnect() .then(({ database, done }) => { if (typeof phone !== 'string') { + done(); reject(new Error('typeof phone must be string')); } if (phone.substring(0, 2) !== '+1') { + done(); reject(new Error('phone must be string formatted as such: +1XXXXXXXXXX')); } client.verify.services