Commit 9942a8a5 authored by Sean Hammond's avatar Sean Hammond

Fix tests in PhantomJS

parent 6c989a43
...@@ -51,6 +51,34 @@ describe('time', function () { ...@@ -51,6 +51,34 @@ describe('time', function () {
}); });
describe('.toFuzzyString', function () { describe('.toFuzzyString', function () {
var originalIntl;
before(function () {
// Intl isn't implemented in PhantomJS so we have to mock it in these
// tests. The mock version returns the results we'd expect from the real
// one for the test values that we use.
originalIntl = window.Intl;
window.Intl = {
DateTimeFormat: function () {
return {
format: function () {
if (new Date().getYear() === 70) {
return '01 Jan';
} else {
return '01 Jan 1970';
}
}
};
}
};
});
after(function () {
window.Intl = originalIntl;
});
it('Handles empty dates', function () { it('Handles empty dates', function () {
var t = null; var t = null;
var expect = ''; var expect = '';
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment