Skip to content

Commit 241fba4

Browse files
committed
Adds test cases for event callbacks
1 parent 23b4a13 commit 241fba4

File tree

1 file changed

+24
-1
lines changed

1 file changed

+24
-1
lines changed

test/index.js

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ describe('G-code Interpreter', (done) => {
1515
}
1616

1717
let runner = new GCodeRunner();
18-
1918
it('should call interpretText\'s callback.', (done) => {
2019
runner.interpretText(null, (err, results) => {
2120
expect(err).to.be.okay;
@@ -36,6 +35,30 @@ describe('G-code Interpreter', (done) => {
3635
});
3736
});
3837

38+
describe('Event callbacks', (done) => {
39+
class GCodeRunner extends GCodeInterpreter {
40+
constructor(options) {
41+
super(options);
42+
}
43+
}
44+
45+
let runner = new GCodeRunner();
46+
runner
47+
.on('data', (data) => {
48+
expect(data).to.be.an('object');
49+
})
50+
.on('end', (results) => {
51+
expect(results).to.be.an('array');
52+
});
53+
54+
it('should call event callbacks.', (done) => {
55+
runner.interpretFile('test/fixtures/circle.nc', (err, results) => {
56+
expect(err).to.be.okay;
57+
done();
58+
});
59+
});
60+
});
61+
3962
describe('G-code: circle', (done) => {
4063
let calls = {};
4164

0 commit comments

Comments
 (0)