Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
test: switch to expect interface
Browse files Browse the repository at this point in the history
  • Loading branch information
benesch committed Jul 1, 2014
1 parent 8f9a6f0 commit d5107bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
19 changes: 10 additions & 9 deletions test/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
var http = require("http")
var expect = require("chai").expect
, http = require("http")
, Promise = require("bluebird")
, supertest = require("supertest")
, supertestAsPromised = require("..");
Expand All @@ -13,22 +14,22 @@ describe("supertestAsPromised", function () {
describe("Test instances", function () {
describe("#then", function () {
it("should return a promise", function () {
request.get("/home").then().should.be.an.instanceOf(Promise);
expect(request.get("/home").then()).to.be.an.instanceOf(Promise);
});
});

it("should fulfill if all assertions pass", function () {
return request.get("/home").expect(200).should.eventually.be.fulfilled;
return expect(request.get("/home").expect(200)).to.eventually.be.fulfilled;
});

it("should fulfill with the response", function () {
return request.get("/home").then(function (res) {
res.text.should.equal("helo");
expect(res.text).to.equal("helo");
});
});

it("should reject if an assertion fails", function () {
return request.get("/home").expect(500).should.eventually.be.rejected;
return expect(request.get("/home").expect(500)).to.eventually.be.rejected;
});
});

Expand All @@ -37,22 +38,22 @@ describe("supertestAsPromised", function () {

describe("#then", function () {
it("should return a promise", function () {
agent.get("/home").then().should.be.an.instanceOf(Promise);
expect(agent.get("/home").then()).to.be.an.instanceOf(Promise);
});
});

it("should fulfill if all assertions pass", function () {
return agent.get("/home").expect(200).should.eventually.be.fulfilled;
return expect(agent.get("/home").expect(200)).to.eventually.be.fulfilled;
});

it("should fulfill with the response", function () {
return agent.get("/home").then(function (res) {
res.text.should.equal("helo");
expect(res.text).to.equal("helo");
});
});

it("should reject if an assertion fails", function () {
return agent.get("/home").expect(500).should.eventually.be.rejected;
return expect(agent.get("/home").expect(500)).to.eventually.be.rejected;
});
});
});
Expand Down
1 change: 0 additions & 1 deletion test/setup.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
var chai = require("chai")
, chaiAsPromised = require("chai-as-promised");

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

0 comments on commit d5107bd

Please sign in to comment.