Skip to content

Commit

Permalink
Merge pull request #66 from Jameskmonger/master
Browse files Browse the repository at this point in the history
Fix #65: Test and distribute before publishing
  • Loading branch information
remojansen committed Feb 3, 2016
2 parents 0ca5734 + b60ed84 commit a52c29e
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
7 changes: 3 additions & 4 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,8 +111,8 @@ gulp.task("cover", function() {
.pipe(coveralls());
});

gulp.task("test", function(cb) {
runSequence("istanbul:hook", "mocha", "cover", cb);
gulp.task("build-and-test", function(cb) {
runSequence("build", "istanbul:hook", "mocha", "cover", cb);
});

//******************************************************************************
Expand Down Expand Up @@ -163,8 +163,7 @@ gulp.task("dist", function(cb) {
gulp.task("default", function (cb) {
runSequence(
"lint",
"build",
"test",
"build-and-test",
"dist",
cb);
});
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"test": "test"
},
"scripts": {
"test": "gulp"
"test": "gulp",
"prepublish": "gulp build-and-test && gulp dist"
},
"repository": {
"type": "git",
Expand Down
28 changes: 14 additions & 14 deletions test/inject_annotation.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,60 +5,60 @@ import { Inject } from "../source/inversify";

describe('Inject Annotation', () => {
it('should generate metadata for annotated classes', () => {

interface IKatana {
power : number;
hit() : boolean;
}

interface IShuriken {
power : number;
throw() : boolean;
}

@Inject("IKatana", "IShuriken")
class Warrior {

private _katana : IKatana;
private _shuriken : IShuriken;

constructor(katana : IKatana, shuriken : IShuriken) {
this._katana = katana;
this._shuriken = shuriken;
}
}

class WarriorWithoutInjections {

private _katana : IKatana;
private _shuriken : IShuriken;

constructor(katana : IKatana, shuriken : IShuriken) {
this._katana = katana;
this._shuriken = shuriken;
}
}

@Inject()
class WarriorDecoratedWithoutInjections {

private _katana : IKatana;
private _shuriken : IShuriken;

constructor(katana : IKatana, shuriken : IShuriken) {
this._katana = katana;
this._shuriken = shuriken;
}
}

var argumentTypes = (<any>Warrior).__INJECT;
expect(argumentTypes.length).to.equal(2);
expect(argumentTypes[0]).to.equal("IKatana");
expect(argumentTypes[1]).to.equal("IShuriken");

var argumentTypes = (<any>WarriorWithoutInjections).__INJECT;
expect(typeof argumentTypes).to.equal("undefined");

var argumentTypes = (<any>WarriorDecoratedWithoutInjections).__INJECT;
expect(argumentTypes.length).to.equal(0);
});
Expand Down

0 comments on commit a52c29e

Please sign in to comment.