Skip to content

Commit

Permalink
chore(typings): Fixed missing typings for chai-spies
Browse files Browse the repository at this point in the history
  • Loading branch information
dotansimha committed Nov 7, 2016
1 parent 5d22b3d commit f3eded9
Show file tree
Hide file tree
Showing 3 changed files with 95 additions and 8 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ node_modules/
npm-debug.log
typings
.idea
.meteor/local
build
dist
12 changes: 6 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@
"test:ci": "meteor test --once --driver-package dispatch:mocha-phantomjs"
},
"devDependencies": {
"@types/chai": "^3.4.33",
"@types/mocha": "^2.2.32",
"@types/chai": "3.4.33",
"@types/mocha": "2.2.32",
"chai": "3.5.0",
"chai-spies": "0.7.1"
"chai-spies": "0.7.1",
"meteor-typings": "1.3.1",
"meteor-node-stubs": "0.2.3"
},
"dependencies": {
"@angular/common": "2.1.2",
Expand All @@ -27,11 +29,9 @@
"angular2-meteor": "0.7.0",
"angular2-meteor-polyfills": "0.1.1",
"angular2-meteor-tests-polyfills": "0.0.2",
"meteor-node-stubs": "0.2.3",
"meteor-rxjs": "0.4.3",
"reflect-metadata": "0.1.8",
"rxjs": "5.0.0-beta.12",
"zone.js": "0.6.26",
"meteor-typings": "1.3.1"
"zone.js": "0.6.26"
}
}
88 changes: 87 additions & 1 deletion typings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,96 @@ declare module "meteor/hwillson:stub-collections" {

interface IStubCollections {
stub(collection: Mongo.Collection);
restore();s
restore();
}

const StubCollections: IStubCollections;

export default StubCollections;
}

declare module "chai-spies" {
const chaiSpies: (chai: any, utils: any) => void;

export = chaiSpies;
}

interface SpyCalledWith extends Chai.Assertion {
(...args: any[]): void;
exactly(...args: any[]): void;
}

interface SpyCalledAlways extends Chai.Assertion {
with: SpyCalledWith;
}

interface SpyCalledAt {
most(n: number): void;
least(n: number): void;
}

interface SpyCalled {
(n?: number): void;
/**
* Assert that a spy has been called exactly once
*
* @api public
*/
once: any;
/**
* Assert that a spy has been called exactly twice.
*
* @api public
*/
twice: any;
/**
* Assert that a spy has been called exactly `n` times.
*
* @param {Number} n times
* @api public
*/
exactly(n: number): void;
with: SpyCalledWith;
/**
* Assert that a spy has been called `n` or more times.
*
* @param {Number} n times
* @api public
*/
min(n: number): void;
/**
* Assert that a spy has been called `n` or fewer times.
*
* @param {Number} n times
* @api public
*/
max(n: number): void;
at: SpyCalledAt;
above(n: number): void;
/**
* Assert that a spy has been called more than `n` times.
*
* @param {Number} n times
* @api public
*/
gt(n: number): void;
below(n: number): void;
/**
* Assert that a spy has been called less than `n` times.
*
* @param {Number} n times
* @api public
*/
lt(n: number): void;
}

declare namespace Chai {
interface ChaiStatic {
spy(): any;
}

interface Assertion {
called: SpyCalled;
always: SpyCalledAlways;
}
}

0 comments on commit f3eded9

Please sign in to comment.