Skip to content

Commit

Permalink
remove chai as promised due to several issue with the assertions pass…
Browse files Browse the repository at this point in the history
  • Loading branch information
codeEmitter committed Dec 28, 2016
1 parent 3778a81 commit 2fe0a5f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 10 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
"babel-polyfill": "6.3.14",
"babel-preset-es2015": "6.13.2",
"chai": "3.5.0",
"chai-as-promised": "6.0.0",
"mocha": "3.2.0"
},
"dependencies": {
Expand Down
30 changes: 21 additions & 9 deletions test/MssqlSnapshot.testConnection.spec.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import 'babel-polyfill';
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';

chai.use(chaiAsPromised);
chai.should();

import databaseConfig from '../src/databaseConfig';
Expand All @@ -15,11 +13,17 @@ describe("when testing the database connection with invalid config info", functi
msg = "Login failed for user 'incorrectUser'.";
target = new MssqlSnapshot(new Database({user: "incorrectUser"}))
});
it("it rejects with a proper error message", () => {
target.testConnection().should.be.rejectedWith(msg)
});
it("it returns a thenable promise", () => {
target.testConnection().should.be.an.instanceOf(Promise);
it("it rejects with a proper error message", (done) => {
target.testConnection().then(
(result) => {
done(result);
},
(err) => {
err.message.should.eql(msg);
err.code.should.eql("ELOGIN");
done();
}
);
});
});

Expand All @@ -29,7 +33,15 @@ describe("when testing the database connection with valid config info", function
dbConfig = databaseConfig();
target = new MssqlSnapshot(new Database(dbConfig));
});
it("it resolves with a success message", () => {
target.testConnection().should.become("Success!");
it("it resolves with a success message", (done) => {
target.testConnection().then(
(result) => {
result.should.eql("Success!");
done()
},
(err) => {
done(err);
}
);
});
});

0 comments on commit 2fe0a5f

Please sign in to comment.