diff --git a/__tests__/functions/databases/mongoose/create.js b/__tests__/functions/databases/mongoose/create.js index 9d4ea26..acd637f 100644 --- a/__tests__/functions/databases/mongoose/create.js +++ b/__tests__/functions/databases/mongoose/create.js @@ -1,58 +1,52 @@ -const mongoose = require('mongoose'); -const mongooseCreate = require ('../../../../functions/databases/mongoose/create'); +const mongoose = require("mongoose"); +const mongooseCreate = require("../../../../functions/databases/mongoose/create"); -describe('tests the create function', () => { - class FakeClient { - constructor( - AccSID, - AuthToken - ) { - this.AccSID = AccSID; - this.AuthToken = AuthToken; - this.client = { - verify: { - services: { - create: () => { - const isError = this.isError; - return new Promise((resolve, reject) => { - if (isError) { - reject(new Error("fake error message")); - } - resolve({ - sid: "fakeSid" - }); - }); +describe("tests the create function", () => { + class FakeClient { + constructor(AccSID, AuthToken) { + this.AccSID = AccSID; + this.AuthToken = AuthToken; + this.client = { + verify: { + services: { + create: () => { + const isError = this.isError; + return new Promise((resolve, reject) => { + if (isError) { + reject(new Error("fake error message")); } - } + resolve({ + sid: "fakeSid" + }); + }); } - }; - this.TwoAuthUser = { - create: ({ - userID, - sid, - phone - }) => { - return new Promise((resolve, reject) => { - resolve(5) - }) - } - }; - this.create = mongooseCreate; + } + } + }; + this.TwoAuthUser = { + create: ({ userID, sid, phone }) => { + return new Promise((resolve, reject) => { + resolve(5); + }); } - } + }; + this.create = mongooseCreate; + } + } - it('generates a user with the right sid', async () => { - const newClient = new FakeClient(); - // create a user using client.create() - let result = await newClient.create('ian', '+17604307620') - expect(result).toBe(5) - // query database for that user - }); + it("generates a user with the right sid", async () => { + const newClient = new FakeClient(); + // create a user using client.create() + let result = await newClient.create("ian", "+17604307620"); + expect(result).toBe(5); + // query database for that user + }); - it('passes error message on rejection', () => { - const newClient = new FakeClient(); - let users = newClient.users; - newClient.create('ian', '+17604307620').catch(err => { expect(err instanceof Error).toBeTruthy(); - }); + it("passes error message on rejection", () => { + const newClient = new FakeClient(); + let users = newClient.users; + newClient.create("ian", "+17604307620").catch(err => { + expect(err instanceof Error).toBeTruthy(); }); -}); \ No newline at end of file + }); +}); diff --git a/package.json b/package.json index db5acca..922c76c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "two-auth", - "version": "1.0.2", - "description": "This is the two factor twilio library.", + "version": "2.0.0", + "description": "Implement two-factor SMS authentication with the Twilio API in three lines of code.", "main": "index.js", "scripts": { "test": "jest --verbose" @@ -12,6 +12,8 @@ }, "keywords": [ "2fa", + "sms", + "two factor", "two-factor", "two", "two-factor-authentication", @@ -37,4 +39,4 @@ "dotenv": "^8.0.0", "jest": "^24.8.0" } -} +} \ No newline at end of file