Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
43c75cc
commit 7a32165
Showing
11 changed files
with
170 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Conan from "../../lib/conan.js"; | ||
import privateData from "incognito"; | ||
|
||
describe("conan.events", () => { | ||
it("should return staircase's event emitter", () => { | ||
const conan = new Conan(); | ||
conan.events.should.eql(privateData(conan).staircase.events); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Conan from "../../lib/conan.js"; | ||
|
||
describe("conan.on", () => { | ||
let conan; | ||
|
||
beforeEach(() => { | ||
conan = new Conan(); | ||
}); | ||
|
||
it("should create a new event handler", done => { | ||
conan.on("test", (one, two) => { | ||
[one, two].should.eql([1, 2]); | ||
done(); | ||
}); | ||
|
||
conan.events.emit("test", 1, 2); | ||
}); | ||
|
||
it("should return this to enable chaining", () => { | ||
conan.on("something", () => {}).should.eql(conan); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import Conan from "../../lib/conan.js"; | ||
|
||
describe("conan.events.on('step:start', handler)", () => { | ||
it("should call the provided handler each time a step starts", done => { | ||
const conan = new Conan(); | ||
|
||
const calledSteps = []; | ||
|
||
conan | ||
.on("step:start", (deployer, step) => { | ||
calledSteps.push(step); | ||
}) | ||
.step(function stepOne() {}) | ||
.series(function stepTwo() {}).apply(1, 2, 3); | ||
|
||
conan | ||
.deploy(() => { | ||
calledSteps.should.eql([ | ||
{ name: "stepOne", arguments: [conan] }, | ||
{ name: "stepTwo", arguments: [conan, 1, 2, 3] } | ||
]); | ||
|
||
done(); | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Conan from "../../lib/conan.js"; | ||
import privateData from "incognito"; | ||
|
||
describe("conan.events", () => { | ||
it("should return staircase's event emitter", () => { | ||
const conan = new Conan(); | ||
conan.events.should.eql(privateData(conan).staircase.events); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import Conan from "../../lib/conan.js"; | ||
|
||
describe("conan.on", () => { | ||
let conan; | ||
|
||
beforeEach(() => { | ||
conan = new Conan(); | ||
}); | ||
|
||
it("should create a new event handler", done => { | ||
conan.on("test", (one, two) => { | ||
[one, two].should.eql([1, 2]); | ||
done(); | ||
}); | ||
|
||
conan.events.emit("test", 1, 2); | ||
}); | ||
|
||
it("should return this to enable chaining", () => { | ||
conan.on("something", () => {}).should.eql(conan); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters