Skip to content

Commit

Permalink
🔥 old tests, increase coverage in certain areas
Browse files Browse the repository at this point in the history
  • Loading branch information
connor4312 committed Oct 9, 2016
1 parent 376a0d9 commit 042dabf
Show file tree
Hide file tree
Showing 9 changed files with 166 additions and 650 deletions.
16 changes: 6 additions & 10 deletions README.md
Expand Up @@ -2,18 +2,14 @@

An [InfluxDB](http://influxdb.org/) Node.js Client

[![npm](http://img.shields.io/npm/v/influx.svg?style=flat-square)](https://www.npmjs.org/package/influx)
[![build](http://img.shields.io/travis/node-influx/node-influx/master.svg?style=flat-square)](https://travis-ci.org/node-influx/node-influx)
[![coverage](http://img.shields.io/coveralls/node-influx/node-influx/master.svg?style=flat-square)](https://coveralls.io/r/node-influx/node-influx?branch=master)
[![code climate](http://img.shields.io/codeclimate/github/node-influx/node-influx.svg?style=flat-square)](https://codeclimate.com/github/node-influx/node-influx)
[![Dependency Status](https://img.shields.io/david/node-influx/node-influx.svg?style=flat-square)](https://david-dm.org/node-influx/node-influx)
[![Github Releases](https://img.shields.io/npm/dm/influx.svg?style=flat-square)](https://github.com/node-influx/node-influx)
[![Gitter](https://img.shields.io/gitter/room/node-influx/node-influx.js.svg?maxAge=2592000&style=flat-square)](https://gitter.im/node-influx/node-influx?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![npm](http://img.shields.io/npm/v/influx.svg)](https://www.npmjs.org/package/influx)
[![build](http://img.shields.io/travis/node-influx/node-influx/master.svg)](https://travis-ci.org/node-influx/node-influx)
[![coverage](http://img.shields.io/coveralls/node-influx/node-influx/master.svg)](https://coveralls.io/r/node-influx/node-influx?branch=master)
[![bitHound Overall Score](https://www.bithound.io/github/node-influx/node-influx/badges/score.svg)](https://www.bithound.io/github/node-influx/node-influx)
[![bitHound Code](https://www.bithound.io/github/node-influx/node-influx/badges/code.svg)](https://www.bithound.io/github/node-influx/node-influx)
[![bitHound Dependencies](https://www.bithound.io/github/node-influx/node-influx/badges/dependencies.svg)](https://www.bithound.io/github/node-influx/node-influx/master/dependencies/npm)



[![Bountysource](https://img.shields.io/bountysource/team/node-influx/activity.svg?style=flat-square)](https://www.bountysource.com/teams/node-influx) - Reward the contributors for their efforts on upcoming tasks.

## Installation

$ npm install influx
Expand Down
2 changes: 1 addition & 1 deletion package.json
Expand Up @@ -39,7 +39,7 @@
"coveralls": "^2.11.1",
"istanbul": "^0.4.3",
"lodash": "^4.16.2",
"mocha": "^2.4.5",
"mocha": "^3.1.0",
"node-fetch": "^1.6.3",
"opn-cli": "^3.1.0",
"sinon": "^1.17.4",
Expand Down
8 changes: 6 additions & 2 deletions src/builder.ts
Expand Up @@ -114,7 +114,7 @@ export class Expression implements ExpressionHead, ExpressionTail, BinaryOp {
}

public exp(fn: (e: Expression) => Expression): this {
this.query.push(fn(new Expression()).toString());
this.query.push("(" + fn(new Expression()).toString() + ")");
return this;
}

Expand Down Expand Up @@ -149,7 +149,7 @@ export class Expression implements ExpressionHead, ExpressionTail, BinaryOp {
return this;
}

throw new Error(`node-influx doesn't know how to encode [${value}] into a ` +
throw new Error(`node-influx doesn't know how to encode the provided value into a ` +
"query. If you think this is a bug, open an issue here: https://git.io/influx-err");
}
}
Expand Down Expand Up @@ -258,6 +258,10 @@ export class Measurement {
}

public toString(): string {
if (!this.parts[2]) {
throw new Error(`You must specify a measurement name to query! Got \`${this.parts[2]}\``);
}

return this.parts.filter(p => !!p)
.map(p => escape.quoted(p))
.join(".");
Expand Down
10 changes: 5 additions & 5 deletions src/grammar/times.ts
Expand Up @@ -87,13 +87,13 @@ export type TimePrecision = "n" | "u" | "ms" | "s" | "m" | "h";
/**
* Precision is a map of available Influx time precisions.
*/
export type Precision = {
export const Precision = {
Hours: "h",
Minutes: "m",
Seconds: "s",
Milliseconds: "ms",
Microseconds: "u",
Milliseconds: "ms",
Minutes: "m",
Nanoseconds: "n",
Seconds: "s",
};

/**
Expand Down Expand Up @@ -243,7 +243,7 @@ class NanosecondsDateManipulator implements IDateManipulator<NanoDate> {

switch (precision) {
case "u":
return date.getNanoTime().slice(0, -6);
return date.getNanoTime().slice(0, -3);
case "n":
return date.getNanoTime();

Expand Down
4 changes: 3 additions & 1 deletion src/index.ts
Expand Up @@ -20,8 +20,10 @@ const defaultOptions: ClusterConfig = Object.freeze({
username: "root",
});

export * from "./grammar";
export * from "./builder";
export { FieldType, Precision, TimePrecision, toNanoDate } from "./grammar";
export { SchemaOptions } from "./schema";
export { PoolOptions } from "./pool";

export interface HostConfig {

Expand Down

0 comments on commit 042dabf

Please sign in to comment.