Reformat features-test.js

stable/1.0.x
Alex Gleason 2020-06-07 14:26:28 -05:00
rodzic d772608df4
commit cc6aae5937
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
1 zmienionych plików z 21 dodań i 21 usunięć

Wyświetl plik

@ -2,11 +2,11 @@ import {
parseVersion, parseVersion,
getFeatures, getFeatures,
} from '../features'; } from '../features';
import { fromJS } from 'immutable'; import { Map as ImmutableMap } from 'immutable';
describe('parseVersion', () => { describe('parseVersion', () => {
it('with Pleroma version string', () => { it('with Pleroma version string', () => {
let version = '2.7.2 (compatible; Pleroma 2.0.5-6-ga36eb5ea-plerasstodon+dev)'; const version = '2.7.2 (compatible; Pleroma 2.0.5-6-ga36eb5ea-plerasstodon+dev)';
expect(parseVersion(version)).toEqual({ expect(parseVersion(version)).toEqual({
software: 'Pleroma', software: 'Pleroma',
version: '2.0.5-6-ga36eb5ea-plerasstodon+dev', version: '2.0.5-6-ga36eb5ea-plerasstodon+dev',
@ -15,7 +15,7 @@ describe('parseVersion', () => {
}); });
it('with Mastodon version string', () => { it('with Mastodon version string', () => {
let version = '3.0.0'; const version = '3.0.0';
expect(parseVersion(version)).toEqual({ expect(parseVersion(version)).toEqual({
software: 'Mastodon', software: 'Mastodon',
version: '3.0.0', version: '3.0.0',
@ -27,68 +27,68 @@ describe('parseVersion', () => {
describe('getFeatures', () => { describe('getFeatures', () => {
describe('emojiReacts', () => { describe('emojiReacts', () => {
it('is true for Pleroma 2.0+', () => { it('is true for Pleroma 2.0+', () => {
let instance = fromJS({ const instance = ImmutableMap({
version: '2.7.2 (compatible; Pleroma 2.0.5-6-ga36eb5ea-plerasstodon+dev)', version: '2.7.2 (compatible; Pleroma 2.0.5-6-ga36eb5ea-plerasstodon+dev)',
}); });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.emojiReacts).toBe(true); expect(features.emojiReacts).toBe(true);
}); });
it('is false for Pleroma < 2.0', () => { it('is false for Pleroma < 2.0', () => {
let instance = fromJS({ const instance = ImmutableMap({
version: '2.7.2 (compatible; Pleroma 1.1.50-42-g3d9ac6ae-develop)', version: '2.7.2 (compatible; Pleroma 1.1.50-42-g3d9ac6ae-develop)',
}); });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.emojiReacts).toBe(false); expect(features.emojiReacts).toBe(false);
}); });
it('is false for Mastodon', () => { it('is false for Mastodon', () => {
let instance = fromJS({ version: '3.1.4' }); const instance = ImmutableMap({ version: '3.1.4' });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.emojiReacts).toBe(false); expect(features.emojiReacts).toBe(false);
}); });
}); });
describe('suggestions', () => { describe('suggestions', () => {
it('is true for Mastodon 2.4.3+', () => { it('is true for Mastodon 2.4.3+', () => {
let instance = fromJS({ version: '2.4.3' }); const instance = ImmutableMap({ version: '2.4.3' });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.suggestions).toBe(true); expect(features.suggestions).toBe(true);
}); });
it('is false for Mastodon < 2.4.3', () => { it('is false for Mastodon < 2.4.3', () => {
let instance = fromJS({ version: '2.4.2' }); const instance = ImmutableMap({ version: '2.4.2' });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.suggestions).toBe(false); expect(features.suggestions).toBe(false);
}); });
it('is false for Pleroma', () => { it('is false for Pleroma', () => {
let instance = fromJS({ const instance = ImmutableMap({
version: '2.7.2 (compatible; Pleroma 1.1.50-42-g3d9ac6ae-develop)', version: '2.7.2 (compatible; Pleroma 1.1.50-42-g3d9ac6ae-develop)',
}); });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.suggestions).toBe(false); expect(features.suggestions).toBe(false);
}); });
}); });
describe('trends', () => { describe('trends', () => {
it('is true for Mastodon 3.0.0+', () => { it('is true for Mastodon 3.0.0+', () => {
let instance = fromJS({ version: '3.0.0' }); const instance = ImmutableMap({ version: '3.0.0' });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.trends).toBe(true); expect(features.trends).toBe(true);
}); });
it('is false for Mastodon < 3.0.0', () => { it('is false for Mastodon < 3.0.0', () => {
let instance = fromJS({ version: '2.4.3' }); const instance = ImmutableMap({ version: '2.4.3' });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.trends).toBe(false); expect(features.trends).toBe(false);
}); });
it('is false for Pleroma', () => { it('is false for Pleroma', () => {
let instance = fromJS({ const instance = ImmutableMap({
version: '2.7.2 (compatible; Pleroma 1.1.50-42-g3d9ac6ae-develop)', version: '2.7.2 (compatible; Pleroma 1.1.50-42-g3d9ac6ae-develop)',
}); });
let features = getFeatures(instance); const features = getFeatures(instance);
expect(features.trends).toBe(false); expect(features.trends).toBe(false);
}); });
}); });