-
Notifications
You must be signed in to change notification settings - Fork 1
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
Showing
3 changed files
with
144 additions
and
5 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,79 @@ | ||
'use strict' | ||
|
||
var Async = require('async') | ||
|
||
var Lab = require('lab') | ||
var lab = exports.lab = Lab.script() | ||
var suite = lab.suite | ||
var test = lab.test | ||
var before = lab.before | ||
var Code = require('code') | ||
var expect = Code.expect | ||
|
||
var Util = require('./util.js') | ||
|
||
// suite('load state into state-machine tests', function () { | ||
// var seneca | ||
|
||
// before({}, function (done) { | ||
// Util.init({}, function (err, si) { | ||
// expect(err).to.not.exist() | ||
|
||
// seneca = si | ||
// done() | ||
// }) | ||
// }) | ||
|
||
// function verifyState(state, callback) { | ||
// seneca.act('role:' + Util.config.name + ', get:context', function (err, context) { | ||
// expect(err).to.not.exist() | ||
// expect(context).to.exist() | ||
// expect(context.current_status).to.equal(state) | ||
|
||
// callback(err) | ||
// }) | ||
// } | ||
|
||
// test('load state', function (done) { | ||
// // add before and after actions | ||
// seneca.add({role: 'transport', execute: 'before_state_change'}, function (args, done) { | ||
// if (args.shouldFail) { | ||
// return done('Some error') | ||
// } | ||
// done(null, {data: 'OK', before: true}) | ||
// }) | ||
|
||
// seneca.add({role: 'transport', execute: 'after_state_change'}, function (args, done) { | ||
// if (args.shouldFail) { | ||
// return done('Some error') | ||
// } | ||
// done(null, {data: 'OK', after: true}) | ||
// }) | ||
|
||
// Async.series({ | ||
// create_instance: function (callback) { | ||
// seneca.act("role: 'sm', create: 'instance'", Util.config, function (err) { | ||
// expect(err).to.not.exist() | ||
|
||
// callback(err) | ||
// }) | ||
// }, | ||
// init: function (callback) { verifyState('INIT', callback) }, | ||
// before_and_after: function (callback) { | ||
// // go to the NOT_CONFIGURED state, this should fire the before and after events | ||
// seneca.act("role: '" + Util.config.name + "', cmd: 'execute'", {shouldFail: false}, function (err, data) { | ||
// expect(err).to.not.exist() | ||
// expect(data).to.exist() | ||
// expect(data.connect).to.exist() | ||
// callback(err) | ||
// }) | ||
// }, | ||
// notconfigured: function (callback) { verifyState('NOT_CONFIGURED', callback) } | ||
// }, | ||
// function (err, results) { | ||
// expect(err).to.not.exist() | ||
// done() | ||
// }) | ||
// done() | ||
// }) | ||
// }) |