normalizeInstance(): add tests for GoToSocial and Friendica

This commit is contained in:
Alex Gleason
2022-02-23 22:51:23 -05:00
parent fe6ffc9bc5
commit 0c962ee198
2 changed files with 72 additions and 0 deletions

View File

@ -118,4 +118,30 @@ describe('normalizeInstance()', () => {
expect(result.get('configuration') instanceof ImmutableMap).toBe(true);
expect(result.get('description_limit')).toBe(1500);
});
it('normalizes GoToSocial instance', () => {
const instance = fromJS(require('soapbox/__fixtures__/gotosocial-instance.json'));
const result = normalizeInstance(instance);
// Normalizes max_toot_chars
expect(result.getIn(['configuration', 'statuses', 'max_characters'])).toEqual(5000);
expect(result.has('max_toot_chars')).toBe(false);
// Adds configuration and description_limit
expect(result.get('configuration') instanceof ImmutableMap).toBe(true);
expect(result.get('description_limit')).toBe(1500);
});
it('normalizes Friendica instance', () => {
const instance = fromJS(require('soapbox/__fixtures__/friendica-instance.json'));
const result = normalizeInstance(instance);
// Normalizes max_toot_chars
expect(result.getIn(['configuration', 'statuses', 'max_characters'])).toEqual(200000);
expect(result.has('max_toot_chars')).toBe(false);
// Adds configuration and description_limit
expect(result.get('configuration') instanceof ImmutableMap).toBe(true);
expect(result.get('description_limit')).toBe(1500);
});
});