Skip to content
This repository has been archived by the owner on Feb 8, 2019. It is now read-only.

Commit

Permalink
Increase code coverage to 100% (#17)
Browse files Browse the repository at this point in the history
* 0.0.2

* Increased coverage of connect method

* Increased code coverage for connect() method

* Increased code coverage for request()

* 0.1.0
  • Loading branch information
Ethan-Arrowood committed Oct 22, 2017
1 parent 299e92c commit 11fd6d5
Show file tree
Hide file tree
Showing 4 changed files with 706 additions and 789 deletions.
13 changes: 6 additions & 7 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@ class HarperDB {
}

connect(url, username, password) {
if (
arguments.length !== 3 ||
if (arguments.length !== 3)
throw new Error("Connect must be passed 3 arguments");
else if (
typeof url !== "string" ||
typeof username !== "string" ||
typeof password !== "string"
)
throw new Error("Connect must be passed 3 arguments");
throw new Error("connect() arguments must be strings");

const authorization = `Basic ${base64.encode(`${username}:${password}`)}`;

Expand All @@ -35,19 +36,17 @@ class HarperDB {
json: true
};

rp({
return rp({
...options,
body: { operation: "list_users" }
})
.then(() => {
this.event.emit("connection");
console.log("Succesfully connected to server!");
this.isConnected = true;
this.options = options;
})
.catch(error => {
this.event.emit("error");
console.log(`Error: ${error.message}`);
this.event.emit("error", error);
});
}

Expand Down
Loading

0 comments on commit 11fd6d5

Please sign in to comment.