forked from JamieMason/Jasmine-Matchers
/
toBeJsendErrorObject.spec.js
36 lines (34 loc) · 1.16 KB
/
toBeJsendErrorObject.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
var jsendSamples = require('./lib/jsendSampleData');
var validJsend = jsendSamples.valid;
var invalidJsend = jsendSamples.invalid;
// spec
describe('toBeJsendErrorObject', function () {
describe('when invoked', function () {
describe('when subject IS a JSEND error Object', function () {
it('should confirm', function () {
validJsend.error.forEach(function (jsend) {
expect(jsend).toBeJsendErrorObject();
});
});
});
describe('when subject is NOT a JSEND error Object', function () {
it('should deny', function () {
invalidJsend.success.forEach(function (jsend) {
expect(jsend).not.toBeJsendErrorObject();
});
invalidJsend.fail.forEach(function (jsend) {
expect(jsend).not.toBeJsendErrorObject();
});
invalidJsend.error.forEach(function (jsend) {
expect(jsend).not.toBeJsendErrorObject();
});
validJsend.fail.forEach(function (jsend) {
expect(jsend).not.toBeJsendErrorObject();
});
validJsend.success.forEach(function (jsend) {
expect(jsend).not.toBeJsendErrorObject();
});
});
});
});
});