diff --git a/app/soapbox/actions/__tests__/compose.test.js b/app/soapbox/actions/__tests__/compose.test.ts
similarity index 100%
rename from app/soapbox/actions/__tests__/compose.test.js
rename to app/soapbox/actions/__tests__/compose.test.ts
diff --git a/app/soapbox/components/__tests__/autosuggest_emoji.test.js b/app/soapbox/components/__tests__/autosuggest_emoji.test.tsx
similarity index 88%
rename from app/soapbox/components/__tests__/autosuggest_emoji.test.js
rename to app/soapbox/components/__tests__/autosuggest_emoji.test.tsx
index 938ca737b..8fab0ef8b 100644
--- a/app/soapbox/components/__tests__/autosuggest_emoji.test.js
+++ b/app/soapbox/components/__tests__/autosuggest_emoji.test.tsx
@@ -10,7 +10,7 @@ describe('', () => {
colons: ':foobar:',
};
- render();
+ render();
expect(screen.getByTestId('emoji')).toHaveTextContent('foobar');
expect(screen.getByRole('img').getAttribute('src')).not.toBe('http://example.com/emoji.png');
@@ -24,7 +24,7 @@ describe('', () => {
colons: ':foobar:',
};
- render();
+ render();
expect(screen.getByTestId('emoji')).toHaveTextContent('foobar');
expect(screen.getByRole('img').getAttribute('src')).toBe('http://example.com/emoji.png');
diff --git a/app/soapbox/components/__tests__/avatar.test.js b/app/soapbox/components/__tests__/avatar.test.tsx
similarity index 100%
rename from app/soapbox/components/__tests__/avatar.test.js
rename to app/soapbox/components/__tests__/avatar.test.tsx
diff --git a/app/soapbox/components/__tests__/avatar_overlay.test.js b/app/soapbox/components/__tests__/avatar_overlay.test.tsx
similarity index 100%
rename from app/soapbox/components/__tests__/avatar_overlay.test.js
rename to app/soapbox/components/__tests__/avatar_overlay.test.tsx
diff --git a/app/soapbox/components/__tests__/badge.test.js b/app/soapbox/components/__tests__/badge.test.tsx
similarity index 100%
rename from app/soapbox/components/__tests__/badge.test.js
rename to app/soapbox/components/__tests__/badge.test.tsx
diff --git a/app/soapbox/components/__tests__/display_name.test.js b/app/soapbox/components/__tests__/display_name.test.tsx
similarity index 100%
rename from app/soapbox/components/__tests__/display_name.test.js
rename to app/soapbox/components/__tests__/display_name.test.tsx
diff --git a/app/soapbox/components/__tests__/emoji_selector.test.js b/app/soapbox/components/__tests__/emoji_selector.test.tsx
similarity index 100%
rename from app/soapbox/components/__tests__/emoji_selector.test.js
rename to app/soapbox/components/__tests__/emoji_selector.test.tsx
diff --git a/app/soapbox/components/__tests__/scroll-top-button.test.js b/app/soapbox/components/__tests__/scroll-top-button.test.tsx
similarity index 100%
rename from app/soapbox/components/__tests__/scroll-top-button.test.js
rename to app/soapbox/components/__tests__/scroll-top-button.test.tsx
diff --git a/app/soapbox/features/auth_login/components/__tests__/captcha.test.js b/app/soapbox/features/auth_login/components/__tests__/captcha.test.tsx
similarity index 100%
rename from app/soapbox/features/auth_login/components/__tests__/captcha.test.js
rename to app/soapbox/features/auth_login/components/__tests__/captcha.test.tsx
diff --git a/app/soapbox/features/auth_login/components/__tests__/login_form.test.js b/app/soapbox/features/auth_login/components/__tests__/login_form.test.tsx
similarity index 100%
rename from app/soapbox/features/auth_login/components/__tests__/login_form.test.js
rename to app/soapbox/features/auth_login/components/__tests__/login_form.test.tsx
diff --git a/app/soapbox/features/auth_login/components/__tests__/login_page.test.js b/app/soapbox/features/auth_login/components/__tests__/login_page.test.tsx
similarity index 100%
rename from app/soapbox/features/auth_login/components/__tests__/login_page.test.js
rename to app/soapbox/features/auth_login/components/__tests__/login_page.test.tsx
diff --git a/app/soapbox/features/emoji/emoji_picker.ts b/app/soapbox/features/emoji/emoji_picker.js
similarity index 100%
rename from app/soapbox/features/emoji/emoji_picker.ts
rename to app/soapbox/features/emoji/emoji_picker.js
diff --git a/app/soapbox/features/ui/components/__tests__/compose-button.test.js b/app/soapbox/features/ui/components/__tests__/compose-button.test.tsx
similarity index 100%
rename from app/soapbox/features/ui/components/__tests__/compose-button.test.js
rename to app/soapbox/features/ui/components/__tests__/compose-button.test.tsx
diff --git a/app/soapbox/features/ui/components/list_panel.tsx b/app/soapbox/features/ui/components/list_panel.tsx
index 14d6fc82c..8160217e9 100644
--- a/app/soapbox/features/ui/components/list_panel.tsx
+++ b/app/soapbox/features/ui/components/list_panel.tsx
@@ -15,7 +15,7 @@ const getOrderedLists = createSelector([(state: RootState) => state.lists], list
return lists;
}
- return lists.toList().filter(item => !!item).sort((a, b) => (a as ListEntity).title.localeCompare((b as ListEntity).title)).take(4) as ImmutableList;;
+ return lists.toList().filter(item => !!item).sort((a, b) => (a as ListEntity).title.localeCompare((b as ListEntity).title)).take(4) as ImmutableList;
});
const ListPanel = () => {
diff --git a/app/soapbox/features/verification/steps/__tests__/age-verification.test.js b/app/soapbox/features/verification/steps/__tests__/age-verification.test.tsx
similarity index 100%
rename from app/soapbox/features/verification/steps/__tests__/age-verification.test.js
rename to app/soapbox/features/verification/steps/__tests__/age-verification.test.tsx
diff --git a/app/soapbox/features/verification/steps/__tests__/email-verification.test.js b/app/soapbox/features/verification/steps/__tests__/email-verification.test.tsx
similarity index 100%
rename from app/soapbox/features/verification/steps/__tests__/email-verification.test.js
rename to app/soapbox/features/verification/steps/__tests__/email-verification.test.tsx
diff --git a/app/soapbox/features/verification/steps/__tests__/sms-verification.test.js b/app/soapbox/features/verification/steps/__tests__/sms-verification.test.tsx
similarity index 100%
rename from app/soapbox/features/verification/steps/__tests__/sms-verification.test.js
rename to app/soapbox/features/verification/steps/__tests__/sms-verification.test.tsx
diff --git a/app/soapbox/reducers/__tests__/compose-test.js b/app/soapbox/reducers/__tests__/compose.test.ts
similarity index 96%
rename from app/soapbox/reducers/__tests__/compose-test.js
rename to app/soapbox/reducers/__tests__/compose.test.ts
index 1c4e70948..42c276cf6 100644
--- a/app/soapbox/reducers/__tests__/compose-test.js
+++ b/app/soapbox/reducers/__tests__/compose.test.ts
@@ -1,4 +1,4 @@
-import { Map as ImmutableMap, fromJS } from 'immutable';
+import { List as ImmutableList, Map as ImmutableMap, fromJS } from 'immutable';
import * as actions from 'soapbox/actions/compose';
import { ME_FETCH_SUCCESS, ME_PATCH_SUCCESS } from 'soapbox/actions/me';
@@ -220,7 +220,7 @@ describe('compose reducer', () => {
});
it('should handle COMPOSE_SPOILERNESS_CHANGE on CW button click', () => {
- const state = ImmutableMap({ spoiler_text: 'spoiler text', spoiler: true, media_attachments: { } });
+ const state = ImmutableMap({ spoiler_text: 'spoiler text', spoiler: true, media_attachments: ImmutableList() });
const action = {
type: actions.COMPOSE_SPOILERNESS_CHANGE,
};
@@ -337,7 +337,7 @@ describe('compose reducer', () => {
});
it('should handle COMPOSE_UPLOAD_SUCCESS', () => {
- const state = ImmutableMap({ media_attachments: [] });
+ const state = ImmutableMap({ media_attachments: ImmutableList() });
const media = [
{
description: null,
@@ -385,19 +385,18 @@ describe('compose reducer', () => {
});
it('should handle COMPOSE_SUGGESTIONS_CLEAR', () => {
- const state = ImmutableMap({ });
const action = {
type: actions.COMPOSE_SUGGESTIONS_CLEAR,
suggestions: [],
suggestion_token: 'aiekdns3',
};
- expect(reducer(state, action).toJS()).toMatchObject({
+ expect(reducer(undefined, action).toJS()).toMatchObject({
suggestion_token: null,
});
});
it('should handle COMPOSE_SUGGESTION_TAGS_UPDATE', () => {
- const state = ImmutableMap({ tagHistory: [ 'hashtag' ] });
+ const state = ImmutableMap({ tagHistory: ImmutableList([ 'hashtag' ]) });
const action = {
type: actions.COMPOSE_SUGGESTION_TAGS_UPDATE,
token: 'aaadken3',
@@ -410,12 +409,11 @@ describe('compose reducer', () => {
});
it('should handle COMPOSE_TAG_HISTORY_UPDATE', () => {
- const state = ImmutableMap({ });
const action = {
type: actions.COMPOSE_TAG_HISTORY_UPDATE,
tags: [ 'hashtag', 'hashtag2'],
};
- expect(reducer(state, action).toJS()).toMatchObject({
+ expect(reducer(undefined, action).toJS()).toMatchObject({
tagHistory: [ 'hashtag', 'hashtag2' ],
});
});
@@ -450,11 +448,10 @@ describe('compose reducer', () => {
});
it('should handle COMPOSE_POLL_REMOVE', () => {
- const state = ImmutableMap({ });
const action = {
type: actions.COMPOSE_POLL_REMOVE,
};
- expect(reducer(state, action).toJS()).toMatchObject({
+ expect(reducer(undefined, action).toJS()).toMatchObject({
poll: null,
});
});
diff --git a/app/soapbox/reducers/__tests__/contexts-test.js b/app/soapbox/reducers/__tests__/contexts.test.ts
similarity index 91%
rename from app/soapbox/reducers/__tests__/contexts-test.js
rename to app/soapbox/reducers/__tests__/contexts.test.ts
index d5270f0d8..901763091 100644
--- a/app/soapbox/reducers/__tests__/contexts-test.js
+++ b/app/soapbox/reducers/__tests__/contexts.test.ts
@@ -13,7 +13,7 @@ import reducer, { ReducerRecord } from '../contexts';
describe('contexts reducer', () => {
it('should return the initial state', () => {
- expect(reducer(undefined, {})).toEqual(ReducerRecord({
+ expect(reducer(undefined, {} as any)).toEqual(ReducerRecord({
inReplyTos: ImmutableMap(),
replies: ImmutableMap(),
}));
@@ -97,18 +97,18 @@ describe('contexts reducer', () => {
inReplyTos: fromJS({
B: 'A',
C: 'B',
- }),
+ }) as ImmutableMap,
replies: fromJS({
A: ImmutableOrderedSet(['B']),
B: ImmutableOrderedSet(['C']),
- }),
+ }) as ImmutableMap>,
});
const expected = ReducerRecord({
- inReplyTos: fromJS({}),
+ inReplyTos: fromJS({}) as ImmutableMap,
replies: fromJS({
A: ImmutableOrderedSet(),
- }),
+ }) as ImmutableMap>,
});
expect(reducer(state, action)).toEqual(expected);
diff --git a/app/soapbox/reducers/__tests__/list_adder-test.js b/app/soapbox/reducers/__tests__/list_adder.test.ts
similarity index 93%
rename from app/soapbox/reducers/__tests__/list_adder-test.js
rename to app/soapbox/reducers/__tests__/list_adder.test.ts
index 4806d3d13..3989cf5e7 100644
--- a/app/soapbox/reducers/__tests__/list_adder-test.js
+++ b/app/soapbox/reducers/__tests__/list_adder.test.ts
@@ -6,7 +6,7 @@ import reducer from '../list_adder';
describe('list_adder reducer', () => {
it('should return the initial state', () => {
- expect(reducer(undefined, {})).toMatchObject({
+ expect(reducer(undefined, {} as any)).toMatchObject({
accountId: null,
lists: {
@@ -22,7 +22,7 @@ describe('list_adder reducer', () => {
accountId: null,
lists: ImmutableRecord({
- items: ImmutableList(),
+ items: ImmutableList(),
loaded: false,
isLoading: false,
})(),
@@ -46,7 +46,7 @@ describe('list_adder reducer', () => {
accountId: null,
lists: ImmutableRecord({
- items: ImmutableList(),
+ items: ImmutableList(),
loaded: false,
isLoading: false,
})(),
@@ -70,7 +70,7 @@ describe('list_adder reducer', () => {
accountId: null,
lists: ImmutableRecord({
- items: ImmutableList(),
+ items: ImmutableList(),
loaded: false,
isLoading: false,
})(),
diff --git a/app/soapbox/reducers/__tests__/modals-test.js b/app/soapbox/reducers/__tests__/modals.test.ts
similarity index 56%
rename from app/soapbox/reducers/__tests__/modals-test.js
rename to app/soapbox/reducers/__tests__/modals.test.ts
index 36f4fba64..bbb5c4552 100644
--- a/app/soapbox/reducers/__tests__/modals-test.js
+++ b/app/soapbox/reducers/__tests__/modals.test.ts
@@ -1,4 +1,4 @@
-import { List as ImmutableList } from 'immutable';
+import { List as ImmutableList, Record as ImmutableRecord } from 'immutable';
import { MODAL_OPEN, MODAL_CLOSE } from 'soapbox/actions/modals';
@@ -6,11 +6,11 @@ import reducer from '../modals';
describe('modal reducer', () => {
it('should return the initial state', () => {
- expect(reducer(undefined, {})).toEqual(ImmutableList());
+ expect(reducer(undefined, {} as any)).toEqual(ImmutableList());
});
it('should handle MODAL_OPEN', () => {
- const state = ImmutableList();
+ const state = ImmutableList();
const action = {
type: MODAL_OPEN,
modalType: 'type1',
@@ -23,35 +23,43 @@ describe('modal reducer', () => {
});
it('should handle MODAL_CLOSE', () => {
- const state = ImmutableList([{
- modalType: 'type1',
- modalProps: { props1: '1' },
- }]);
+ const state = ImmutableList([
+ ImmutableRecord({
+ modalType: 'type1',
+ modalProps: { props1: '1' },
+ })(),
+ ]);
const action = {
type: MODAL_CLOSE,
};
- expect(reducer(state, action)).toMatchObject(ImmutableList());
+ expect(reducer(state, action).toJS()).toMatchObject([]);
});
it('should handle MODAL_CLOSE with specified modalType', () => {
const state = ImmutableList([
- {
+ ImmutableRecord({
modalType: 'type1',
- },
- {
+ modalProps: null,
+ })(),
+ ImmutableRecord({
modalType: 'type2',
- },
- {
+ modalProps: null,
+ })(),
+ ImmutableRecord({
modalType: 'type1',
- },
+ modalProps: null,
+ })(),
]);
const action = {
type: MODAL_CLOSE,
modalType: 'type2',
};
- expect(reducer(state, action)).toMatchObject(ImmutableList([{
- modalType: 'type1',
- }]));
+ expect(reducer(state, action).toJS()).toEqual([
+ {
+ modalType: 'type1',
+ modalProps: null,
+ },
+ ]);
});
});
diff --git a/app/soapbox/reducers/__tests__/mutes.test.ts b/app/soapbox/reducers/__tests__/mutes.test.ts
index 512a5260f..411db10c6 100644
--- a/app/soapbox/reducers/__tests__/mutes.test.ts
+++ b/app/soapbox/reducers/__tests__/mutes.test.ts
@@ -42,6 +42,8 @@ describe('mutes reducer', () => {
it('should handle MUTES_TOGGLE_HIDE_NOTIFICATIONS', () => {
const state = ImmutableRecord({
new: ImmutableRecord({
+ isSubmitting: false,
+ accountId: null,
notifications: true,
})(),
})();
@@ -50,6 +52,8 @@ describe('mutes reducer', () => {
};
expect(reducer(state, action).toJS()).toEqual({
new: {
+ isSubmitting: false,
+ accountId: null,
notifications: false,
},
});
diff --git a/app/soapbox/utils/__tests__/config_db-test.js b/app/soapbox/utils/__tests__/config_db.test.ts
similarity index 61%
rename from app/soapbox/utils/__tests__/config_db-test.js
rename to app/soapbox/utils/__tests__/config_db.test.ts
index b8ad15e0f..a83757eb3 100644
--- a/app/soapbox/utils/__tests__/config_db-test.js
+++ b/app/soapbox/utils/__tests__/config_db.test.ts
@@ -1,4 +1,4 @@
-import { fromJS } from 'immutable';
+import { List as ImmutableList, fromJS } from 'immutable';
import config_db from 'soapbox/__fixtures__/config_db.json';
@@ -6,7 +6,7 @@ import { ConfigDB } from '../config_db';
test('find', () => {
const configs = fromJS(config_db).get('configs');
- expect(ConfigDB.find(configs, ':phoenix', ':json_library')).toEqual(fromJS({
+ expect(ConfigDB.find(configs as ImmutableList, ':phoenix', ':json_library')).toEqual(fromJS({
group: ':phoenix',
key: ':json_library',
value: 'Jason',
diff --git a/app/soapbox/utils/__tests__/numbers-test.tsx b/app/soapbox/utils/__tests__/numbers.test.tsx
similarity index 100%
rename from app/soapbox/utils/__tests__/numbers-test.tsx
rename to app/soapbox/utils/__tests__/numbers.test.tsx