diff --git a/app/soapbox/reducers/__tests__/accounts-test.js b/app/soapbox/reducers/__tests__/accounts-test.js index 324eae15f..3a8616a58 100644 --- a/app/soapbox/reducers/__tests__/accounts-test.js +++ b/app/soapbox/reducers/__tests__/accounts-test.js @@ -31,29 +31,29 @@ describe('accounts reducer', () => { value: 'https://alexgleason.me', name_emojified: 'Website', value_emojified: 'https://alexgleason.me', - value_plain: 'https://alexgleason.me' + value_plain: 'https://alexgleason.me', }, { name: 'Pleroma+Soapbox', value: 'https://soapbox.pub', name_emojified: 'Pleroma+Soapbox', value_emojified: 'https://soapbox.pub', - value_plain: 'https://soapbox.pub' + value_plain: 'https://soapbox.pub', }, { name: 'Email', value: 'alex@alexgleason.me', name_emojified: 'Email', value_emojified: 'alex@alexgleason.me', - value_plain: 'alex@alexgleason.me' + value_plain: 'alex@alexgleason.me', }, { name: 'Gender identity', value: 'Soyboy', name_emojified: 'Gender identity', value_emojified: 'Soyboy', - value_plain: 'Soyboy' - } + value_plain: 'Soyboy', + }, ], pleroma: { hide_follows: false, @@ -75,24 +75,24 @@ describe('accounts reducer', () => { blocking: false, muting: false, id: '9w1HhmenIAKBHJiUs4', - muting_notifications: false + muting_notifications: false, }, tags: [], hide_favorites: true, is_admin: false, - skip_thread_containment: false + skip_thread_containment: false, }, source: { fields: [], note: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.', pleroma: { actor_type: 'Person', - discoverable: false + discoverable: false, }, - sensitive: false + sensitive: false, }, id: '9w1HhmenIAKBHJiUs4', - note_emojified: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.' + note_emojified: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.', } }; const action = { @@ -127,29 +127,29 @@ describe('accounts reducer', () => { value: 'https://alexgleason.me', name_emojified: 'Website', value_emojified: 'https://alexgleason.me', - value_plain: 'https://alexgleason.me' + value_plain: 'https://alexgleason.me', }, { name: 'Pleroma+Soapbox', value: 'https://soapbox.pub', name_emojified: 'Pleroma+Soapbox', value_emojified: 'https://soapbox.pub', - value_plain: 'https://soapbox.pub' + value_plain: 'https://soapbox.pub', }, { name: 'Email', value: 'alex@alexgleason.me', name_emojified: 'Email', value_emojified: 'alex@alexgleason.me', - value_plain: 'alex@alexgleason.me' + value_plain: 'alex@alexgleason.me', }, { name: 'Gender identity', value: 'Soyboy', name_emojified: 'Gender identity', value_emojified: 'Soyboy', - value_plain: 'Soyboy' - } + value_plain: 'Soyboy', + }, ], pleroma: { hide_follows: false, @@ -171,24 +171,24 @@ describe('accounts reducer', () => { blocking: false, muting: false, id: '9w1HhmenIAKBHJiUs4', - muting_notifications: false + muting_notifications: false, }, tags: [], hide_favorites: true, is_admin: false, - skip_thread_containment: false + skip_thread_containment: false, }, source: { fields: [], note: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.', pleroma: { actor_type: 'Person', - discoverable: false + discoverable: false, }, - sensitive: false + sensitive: false, }, id: '9w1HhmenIAKBHJiUs4', - note_emojified: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.' + note_emojified: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.', }, '9w1HhmenIAKBHJiUs4': { header_static: 'https://media.gleasonator.com/accounts/headers/000/000/001/original/9d0e4dbf1c9dbc8f.png', @@ -211,29 +211,29 @@ describe('accounts reducer', () => { value: 'https://alexgleason.me', name_emojified: 'Website', value_emojified: 'https://alexgleason.me', - value_plain: 'https://alexgleason.me' + value_plain: 'https://alexgleason.me', }, { name: 'Pleroma+Soapbox', value: 'https://soapbox.pub', name_emojified: 'Pleroma+Soapbox', value_emojified: 'https://soapbox.pub', - value_plain: 'https://soapbox.pub' + value_plain: 'https://soapbox.pub', }, { name: 'Email', value: 'alex@alexgleason.me', name_emojified: 'Email', value_emojified: 'alex@alexgleason.me', - value_plain: 'alex@alexgleason.me' + value_plain: 'alex@alexgleason.me', }, { name: 'Gender identity', value: 'Soyboy', name_emojified: 'Gender identity', value_emojified: 'Soyboy', - value_plain: 'Soyboy' - } + value_plain: 'Soyboy', + }, ], pleroma: { hide_follows: false, @@ -255,25 +255,25 @@ describe('accounts reducer', () => { blocking: false, muting: false, id: '9w1HhmenIAKBHJiUs4', - muting_notifications: false + muting_notifications: false, }, tags: [], hide_favorites: true, is_admin: false, - skip_thread_containment: false + skip_thread_containment: false, }, source: { fields: [], note: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.', pleroma: { actor_type: 'Person', - discoverable: false + discoverable: false, }, - sensitive: false + sensitive: false, }, id: '9w1HhmenIAKBHJiUs4', - note_emojified: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.' - } + note_emojified: 'Fediverse developer. I come in peace. #vegan #freeculture #atheist #antiporn #gendercritical. Boosts ≠ endorsements.', + }, }; const action = { type: actions.ACCOUNTS_IMPORT, diff --git a/app/soapbox/reducers/__tests__/auth-test.js b/app/soapbox/reducers/__tests__/auth-test.js index e5ea31936..237653076 100644 --- a/app/soapbox/reducers/__tests__/auth-test.js +++ b/app/soapbox/reducers/__tests__/auth-test.js @@ -1,7 +1,9 @@ import reducer from '../auth'; -import { Map as ImmutableMap, List as ImmutableList } from 'immutable'; +import { Map as ImmutableMap, List as ImmutableList, fromJS } from 'immutable'; import * as actions from '../auth'; +const auth = + describe('auth reducer', () => { it('should return the initial state', () => { expect(reducer(undefined, {})).toEqual(ImmutableMap({ @@ -13,12 +15,63 @@ describe('auth reducer', () => { it('should handle AUTH_APP_CREATED', () => { const state = ImmutableMap({ }); + const auth = { + auth: { + app: { + vapid_key: 'BHczIFh4Wn3Q_7wDgehaB8Ti3Uu8BoyOgXxkOVuEJRuEqxtd9TAno8K9ycz4myiQ1ruiyVfG6xT1JLeXtpxDzUs', + token_type: 'Bearer', + client_secret: 'HU6RGO4284Edr4zucuWmn8OFjcpVtMsoXJU0-8tpwRM', + redirect_uri: 'urn:ietf:wg:oauth:2.0:oob', + created_at: 1594050270, + name: 'SoapboxFE_2020-07-06T15:43:31.989Z', + client_id: 'Q0A2r_9ZcEORMenj9kuDRQc3UVL8ypQRoNJ6XQHWJU8', + expires_in: 600, + scope: 'read write follow push admin', + refresh_token: 'aydRA4eragIhavCdAyg6QQnDJmiMbdc-oEBvHYcW_PQ', + website: null, + id: '113', + access_token: 'pbXS8HkoWodrAt_QE1NENcwqigxgWr3P1RIQCKMN0Os' + }, + user: { + access_token: 'UVBP2e17b4pTpb_h8fImIm3F5a66IBVb-JkyZHs4gLE', + expires_in: 600, + me: 'https://social.teci.world/users/curtis', + refresh_token: 'c2DpbVxYZBJDogNn-VBNFES72yXPNUYQCv0CrXGOplY', + scope: 'read write follow push admin', + token_type: 'Bearer' + }, + tokens: [] + } + }; const action = { type: actions.AUTH_APP_CREATED, - app: 'soapbox', + app: auth, }; expect(reducer(state, action).toJS()).toMatchObject({ }); }); + // it('should handle the Action AUTH_LOGGED_OUT', () => { + // const user = { + // access_token: 'UVBP2e17b4pTpb_h8fImIm3F5a66IBVb-JkyZHs4gLE', + // expires_in: 600, + // me: 'https://social.teci.world/users/curtis', + // refresh_token: 'c2DpbVxYZBJDogNn-VBNFES72yXPNUYQCv0CrXGOplY', + // scope: 'read write follow push admin', + // token_type: 'Bearer' + // }; + // expect( + // reducer( + // { + // user: user, + // }, + // { + // type: 'AUTH_LOGGED_OUT', + // }, + // ), + // ).toEqual({ + // user: ImmutableMap(), + // }); + // }); + });