I'm testing jQuery terminal and I got error:
Expected '> ' to equal '> '.
when testing:
$(function() {
describe('Terminal plugin', function() {
describe('terminal create terminal destroy', function() {
var term = $('<div id="term"></div>').appendTo('body').terminal();
it('should have default prompt', function() {
var prompt = term.find('.prompt');
expect(prompt.html()).toEqual("<span>> </span>");
expect(prompt.text()).toEqual('> ');
});
});
});
});
they are same value I just copy it into console and replace to equal
by ==
or ===
and it return true
.
is not a "regular" space, so "> "
and "> "
are not equivalent.
Instead, try expect(prompt.text()).toEqual('>\xA0')
, that being the hex code for a non-breaking space (it's a better idea than putting an actual non-breaking space in there!)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With