Skip to content

Commit

Permalink
tests in progress for pg create
Browse files Browse the repository at this point in the history
  • Loading branch information
Dnaganog committed Jul 8, 2019
1 parent 86c1258 commit c5734a1
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
23 changes: 23 additions & 0 deletions __tests__/functions/databases/postgresql/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: ({})
}
}
}
}
});
2 changes: 2 additions & 0 deletions functions/databases/postgres/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit c5734a1

Please sign in to comment.