Skip to content

Commit

Permalink
style: Linting style fixes for various tests
Browse files Browse the repository at this point in the history
  • Loading branch information
notheotherben committed Mar 11, 2016
1 parent b75793b commit 22eb682
Show file tree
Hide file tree
Showing 15 changed files with 470 additions and 470 deletions.
32 changes: 16 additions & 16 deletions test/Aggregate.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/// <reference path="../typings/DefinitelyTyped/tsd.d.ts" />
import * as Iridium from '../index';
import MongoDB = require('mongodb');
import {Cursor} from '../lib/Cursor';
import Promise = require('bluebird');
import _ = require('lodash');
import * as Iridium from "../index";
import MongoDB = require("mongodb");
import {Cursor} from "../lib/Cursor";
import Promise = require("bluebird");
import _ = require("lodash");

interface TestDocument {
_id?: string;
Expand All @@ -12,7 +12,7 @@ interface TestDocument {
}

class Test extends Iridium.Instance<TestDocument, Test> implements TestDocument {
static collection = 'test';
static collection = "test";
static schema: Iridium.Schema = {
_id: MongoDB.ObjectID,
group: String,
Expand All @@ -25,7 +25,7 @@ class Test extends Iridium.Instance<TestDocument, Test> implements TestDocument
}

describe("Model", () => {
let core = new Iridium.Core({ database: 'test' });
let core = new Iridium.Core({ database: "test" });

before(() => core.connect());

Expand All @@ -34,27 +34,27 @@ describe("Model", () => {

beforeEach(() => {
return core.connect().then(() => model.remove()).then(() => model.insert([
{ group: 'A', score: 10 },
{ group: 'B', score: 11 },
{ group: 'C', score: 12 },
{ group: 'A', score: 13 },
{ group: 'B', score: 14 }
{ group: "A", score: 10 },
{ group: "B", score: 11 },
{ group: "C", score: 12 },
{ group: "A", score: 13 },
{ group: "B", score: 14 }
]));
});

it("should correctly pass through the aggregation pipeline", () => {
return chai.expect(model.aggregate([
{ $group: { _id: '$group', score: { $sum: "$score" } } }
{ $group: { _id: "$group", score: { $sum: "$score" } } }
])).to.eventually.exist.and.have.length(3);
});

it("should allow you to specify the type of the resulting documents", () => {
return model.aggregate<{ _id: string; score: number; }>([
{ $match: { group: 'A' } },
{ $group: { _id: '$group', score: { $sum: "$score" } } }
{ $match: { group: "A" } },
{ $group: { _id: "$group", score: { $sum: "$score" } } }
]).then(results => {
chai.expect(results).to.exist.and.have.length(1);
chai.expect(results[0]._id).to.eql('A');
chai.expect(results[0]._id).to.eql("A");
chai.expect(results[0].score).to.eql(23);
});
});
Expand Down
18 changes: 9 additions & 9 deletions test/Cache.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
/// <reference path="../typings/DefinitelyTyped/tsd.d.ts" />
import * as Iridium from '../index';
import * as Iridium from "../index";

interface Document {
_id?: string;
}

class Instance extends Iridium.Instance<Document, Instance> {
static collection = 'test';
static collection = "test";
static schema: Iridium.Schema = { _id: false };
static cache = new Iridium.CacheOnID();

Expand Down Expand Up @@ -72,29 +72,29 @@ describe("Cache",() => {
let director = new Iridium.CacheOnID();

it("should only report that objects with an _id field are cacheable",() => {
chai.expect(director.valid({ _id: 'test' })).to.be.true;
chai.expect(director.valid(<any>{ noID: 'test' })).to.be.false;
chai.expect(director.valid({ _id: "test" })).to.be.true;
chai.expect(director.valid(<any>{ noID: "test" })).to.be.false;
});

it("should generate a key based on the object's ID",() => {
chai.expect(director.buildKey({ _id: 'test' })).to.be.equal('test');
chai.expect(director.buildKey({ _id: "test' })).to.be.equal('test");
});

it("should only report that queries which specify the _id field are usable",() => {
chai.expect(director.validQuery({ _id: 'test' })).to.be.true;
chai.expect(director.validQuery({ notID: 'test' })).to.be.false;
chai.expect(director.validQuery({ _id: "test" })).to.be.true;
chai.expect(director.validQuery({ notID: "test" })).to.be.false;
});

it("should generate a key based on the query ID",() => {
chai.expect(director.buildQueryKey({ _id: 'test' })).to.be.equal('test');
chai.expect(director.buildQueryKey({ _id: "test' })).to.be.equal('test");
});
});

});

describe("integration",() => {
let core = new Iridium.Core({
database: 'test'
database: "test"
});

let model = new Iridium.Model<Document, Instance>(core, Instance);
Expand Down
Loading

0 comments on commit 22eb682

Please sign in to comment.