[tests] Fix broken tests
This commit is contained in:
@ -3,7 +3,7 @@ import {
|
||||
decodeUri,
|
||||
} from '../../src/js/util/format';
|
||||
|
||||
const encoded = 'c3BvdGlmeTphbGJ1bTpodHRwOi8vdGVzdC5jb20vMTIzIUAjJCVeJltdOzw+Lz8i4oCU4oCTLcOhw4HDoMOAw6LDgsOkw4TDo8ODw6XDhcOmw4bDp8OHw6nDicOow4jDqsOKw6vDi8Otw43DrMOMw67DjsOvw4/DscORw7PDk8Oyw5LDtMOUw7bDlsO1w5XDuMOYxZPFksOfw7rDmsO5w5nDu8Obw7zDnCAubXAz';
|
||||
const encoded = 'c3BvdGlmeTphbGJ1bTpodHRwOi8vdGVzdC5jb20vMTIzIUAjJCVeJltdOzw-Lz8i4oCU4oCTLcOhw4HDoMOAw6LDgsOkw4TDo8ODw6XDhcOmw4bDp8OHw6nDicOow4jDqsOKw6vDi8Otw43DrMOMw67DjsOvw4_DscORw7PDk8Oyw5LDtMOUw7bDlsO1w5XDuMOYxZPFksOfw7rDmsO5w5nDu8Obw7zDnCAubXAz';
|
||||
const decoded = 'spotify:album:http://test.com/123!@#$%^&[];<>/?"—–-áÁàÀâÂäÄãÃåÅæÆçÇéÉèÈêÊëËíÍìÌîÎïÏñÑóÓòÒôÔöÖõÕøØœŒßúÚùÙûÛüÜ .mp3';
|
||||
|
||||
describe('encodeUri', () => {
|
||||
|
||||
@ -159,7 +159,7 @@ describe('buildLink', () => {
|
||||
it('should handle special characters', () => {
|
||||
let link = helpers.buildLink('spotify:album:http://test.com/123!@#$%^&[];<>/?" .mp3');
|
||||
expect(typeof (link)).toBe('string');
|
||||
expect(link).toBe('/album/c3BvdGlmeTphbGJ1bTpodHRwOi8vdGVzdC5jb20vMTIzIUAjJCVeJltdOzw+Lz8iIC5tcDM=');
|
||||
expect(link).toBe('/album/c3BvdGlmeTphbGJ1bTpodHRwOi8vdGVzdC5jb20vMTIzIUAjJCVeJltdOzw-Lz8iIC5tcDM=');
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@ -80,10 +80,16 @@ const dater = (type, data) => {
|
||||
// A four-character date indicates just a year (rather than a full date)
|
||||
if (data.length == 4) {
|
||||
return data;
|
||||
|
||||
// Digest as a date string
|
||||
}
|
||||
var date = new Date(data);
|
||||
|
||||
// Parse ISO dates (yyyy-mm-dd) manually to avoid UTC interpretation
|
||||
var date;
|
||||
if (/^\d{4}-\d{2}-\d{2}$/.test(data)) {
|
||||
var parts = data.split('-');
|
||||
date = new Date(+parts[0], +parts[1] - 1, +parts[2]);
|
||||
} else {
|
||||
date = new Date(data);
|
||||
}
|
||||
return `${date.getDate()}/${date.getMonth() + 1}/${date.getFullYear()}`;
|
||||
|
||||
case 'ago':
|
||||
|
||||
Reference in New Issue
Block a user