Skip to content

Commit

Permalink
Moved outputFormat tests to a separate file
Browse files Browse the repository at this point in the history
  • Loading branch information
sunesimonsen committed Dec 27, 2015
1 parent 6a99e64 commit 1926939
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
23 changes: 23 additions & 0 deletions test/api/outputFormat.spec.js
@@ -0,0 +1,23 @@
/*global expect*/
describe('outputFormat', function () {
describe('when given a format', function () {
it('decides the output that will be used for serializing errors', function () {
expect(function () {
var clonedExpect = expect.clone().outputFormat('html');
clonedExpect(42, 'to equal', 24);
}, 'to throw', {
htmlMessage:
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red; font-weight: bold">expected</span>&nbsp;<span style="color: #0086b3">42</span>&nbsp;<span style="color: red; font-weight: bold">to&nbsp;equal</span>&nbsp;<span style="color: #0086b3">24</span></div>\n' +
'</div>'
});

expect(function () {
var clonedExpect = expect.clone().outputFormat('ansi');
clonedExpect(42, 'to equal', 24);
}, 'to throw', {
message: '\n\x1b[31m\x1b[1mexpected\x1b[22m\x1b[39m 42 \x1b[31m\x1b[1mto equal\x1b[22m\x1b[39m 24'
});
});
});
});
23 changes: 0 additions & 23 deletions test/unexpected.spec.js
Expand Up @@ -737,29 +737,6 @@ describe('unexpected', function () {
});
});

describe('outputFormat', function () {
describe('when given a format', function () {
it('decides the output that will be used for serializing errors', function () {
expect(function () {
var clonedExpect = expect.clone().outputFormat('html');
clonedExpect(42, 'to equal', 24);
}, 'to throw', {
htmlMessage:
'<div style="font-family: monospace; white-space: nowrap">\n' +
' <div><span style="color: red; font-weight: bold">expected</span>&nbsp;<span style="color: #0086b3">42</span>&nbsp;<span style="color: red; font-weight: bold">to&nbsp;equal</span>&nbsp;<span style="color: #0086b3">24</span></div>\n' +
'</div>'
});

expect(function () {
var clonedExpect = expect.clone().outputFormat('ansi');
clonedExpect(42, 'to equal', 24);
}, 'to throw', {
message: '\n\x1b[31m\x1b[1mexpected\x1b[22m\x1b[39m 42 \x1b[31m\x1b[1mto equal\x1b[22m\x1b[39m 24'
});
});
});
});

describe('with the next assertion as a continuation', function () {
describe('with "to have items satisfying" followed by another assertion', function () {
it('should succeed', function () {
Expand Down

0 comments on commit 1926939

Please sign in to comment.