fluentnode
Version:
Fluent apis for node (based on the concepts used in C#'s FluentSharp
63 lines (60 loc) • 1.73 kB
JavaScript
// Generated by CoffeeScript 1.12.7
(function() {
require('../../src/fluentnode');
describe('| Assert | Function', function() {
it('assert_Throws', function(done) {
var error;
(function() {
throw 'exception test';
}).assert_Throws();
(function() {
return aaa.bbb();
}).assert_Throws();
(function() {
throw 'exception test';
}).assert_Throws(function(error) {
return error.assert_Is('exception test');
});
(function() {
throw 'exception test';
}).assert_Throws('exception test');
try {
(function() {
throw 'exception test';
}).assert_Throws('AAAA');
} catch (error1) {
error = error1;
error.message.assert_Is("Expected exception error to be 'AAAA' but it was 'exception test'");
}
try {
return (function() {
return 42 === 42;
}).assert_Throws();
} catch (error1) {
error = error1;
(error === 'fail').assert_Is_False();
error.message.assert_Is('Missing expected exception. [assert_Throws]');
return done();
}
});
it('assert_Not_Throws', function(done) {
var error;
(function() {
return 42 === 42;
}).assert_Not_Throws();
try {
return (function() {
return throws('fail');
}).assert_Not_Throws();
} catch (error1) {
error = error1;
(error === 'fail').assert_Is_False();
return done();
}
});
return it('assert_Is_Function', function() {
(function() {}).assert_Is_Function();
return (function() {}).assert_Is_Function.assert_Is_Function();
});
});
}).call(this);