added test for long links and multiposting

This commit is contained in:
Nicolas Constant 2019-07-29 19:03:50 -04:00
parent 535ad08438
commit 59c323112c
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 9 additions and 1 deletions

View File

@ -85,7 +85,6 @@ describe('CreateStatusComponent', () => {
(<any>component).countStatusChar(status);
expect((<any>component).charCountLeft).toBe(477);
});
it('should not count links more than the minimum', () => {
const status = "http://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/ http://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/ http://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/";
@ -186,4 +185,13 @@ describe('CreateStatusComponent', () => {
expect(result[1]).toContain('@Lorem@ipsum.com ');
});
it('should parse long link properly for multiposting', () => {
const status = 'dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd qsd sqd qsd qsd dsqd qsd qsd sqd qsd sqd dsq http://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/';
(<any>component).maxCharLength = 500;
const result = <string[]>(<any>component).parseStatus(status);
expect(result.length).toBe(2);
expect(result[0].length).toBeLessThanOrEqual(527);
expect(result[1].length).toBeLessThanOrEqual(527);
expect(result[1]).toBe('http://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/');
});
});