edit auth-test

This commit is contained in:
crockwave 2020-07-06 14:42:11 -05:00
parent ca2ccb8a3c
commit ff63b6f6c5
2 changed files with 86 additions and 33 deletions

View file

@ -31,29 +31,29 @@ describe('accounts reducer', () => {
value: '<a href="https://alexgleason.me" rel="ugc">https://alexgleason.me</a>',
name_emojified: 'Website',
value_emojified: '<a href="https://alexgleason.me" rel="ugc">https://alexgleason.me</a>',
value_plain: 'https://alexgleason.me'
value_plain: 'https://alexgleason.me',
},
{
name: 'Pleroma+Soapbox',
value: '<a href="https://soapbox.pub" rel="ugc">https://soapbox.pub</a>',
name_emojified: 'Pleroma+Soapbox',
value_emojified: '<a href="https://soapbox.pub" rel="ugc">https://soapbox.pub</a>',
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. <a class="hashtag" data-tag="vegan" href="https://gleasonator.com/tag/vegan">#vegan</a> <a class="hashtag" data-tag="freeculture" href="https://gleasonator.com/tag/freeculture">#freeculture</a> <a class="hashtag" data-tag="atheist" href="https://gleasonator.com/tag/atheist">#atheist</a> <a class="hashtag" data-tag="antiporn" href="https://gleasonator.com/tag/antiporn">#antiporn</a> <a class="hashtag" data-tag="gendercritical" href="https://gleasonator.com/tag/gendercritical">#gendercritical</a>. Boosts ≠ endorsements.'
note_emojified: 'Fediverse developer. I come in peace. <a class="hashtag" data-tag="vegan" href="https://gleasonator.com/tag/vegan">#vegan</a> <a class="hashtag" data-tag="freeculture" href="https://gleasonator.com/tag/freeculture">#freeculture</a> <a class="hashtag" data-tag="atheist" href="https://gleasonator.com/tag/atheist">#atheist</a> <a class="hashtag" data-tag="antiporn" href="https://gleasonator.com/tag/antiporn">#antiporn</a> <a class="hashtag" data-tag="gendercritical" href="https://gleasonator.com/tag/gendercritical">#gendercritical</a>. Boosts ≠ endorsements.',
}
};
const action = {
@ -127,29 +127,29 @@ describe('accounts reducer', () => {
value: '<a href="https://alexgleason.me" rel="ugc">https://alexgleason.me</a>',
name_emojified: 'Website',
value_emojified: '<a href="https://alexgleason.me" rel="ugc">https://alexgleason.me</a>',
value_plain: 'https://alexgleason.me'
value_plain: 'https://alexgleason.me',
},
{
name: 'Pleroma+Soapbox',
value: '<a href="https://soapbox.pub" rel="ugc">https://soapbox.pub</a>',
name_emojified: 'Pleroma+Soapbox',
value_emojified: '<a href="https://soapbox.pub" rel="ugc">https://soapbox.pub</a>',
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. <a class="hashtag" data-tag="vegan" href="https://gleasonator.com/tag/vegan">#vegan</a> <a class="hashtag" data-tag="freeculture" href="https://gleasonator.com/tag/freeculture">#freeculture</a> <a class="hashtag" data-tag="atheist" href="https://gleasonator.com/tag/atheist">#atheist</a> <a class="hashtag" data-tag="antiporn" href="https://gleasonator.com/tag/antiporn">#antiporn</a> <a class="hashtag" data-tag="gendercritical" href="https://gleasonator.com/tag/gendercritical">#gendercritical</a>. Boosts ≠ endorsements.'
note_emojified: 'Fediverse developer. I come in peace. <a class="hashtag" data-tag="vegan" href="https://gleasonator.com/tag/vegan">#vegan</a> <a class="hashtag" data-tag="freeculture" href="https://gleasonator.com/tag/freeculture">#freeculture</a> <a class="hashtag" data-tag="atheist" href="https://gleasonator.com/tag/atheist">#atheist</a> <a class="hashtag" data-tag="antiporn" href="https://gleasonator.com/tag/antiporn">#antiporn</a> <a class="hashtag" data-tag="gendercritical" href="https://gleasonator.com/tag/gendercritical">#gendercritical</a>. 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: '<a href="https://alexgleason.me" rel="ugc">https://alexgleason.me</a>',
name_emojified: 'Website',
value_emojified: '<a href="https://alexgleason.me" rel="ugc">https://alexgleason.me</a>',
value_plain: 'https://alexgleason.me'
value_plain: 'https://alexgleason.me',
},
{
name: 'Pleroma+Soapbox',
value: '<a href="https://soapbox.pub" rel="ugc">https://soapbox.pub</a>',
name_emojified: 'Pleroma+Soapbox',
value_emojified: '<a href="https://soapbox.pub" rel="ugc">https://soapbox.pub</a>',
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. <a class="hashtag" data-tag="vegan" href="https://gleasonator.com/tag/vegan">#vegan</a> <a class="hashtag" data-tag="freeculture" href="https://gleasonator.com/tag/freeculture">#freeculture</a> <a class="hashtag" data-tag="atheist" href="https://gleasonator.com/tag/atheist">#atheist</a> <a class="hashtag" data-tag="antiporn" href="https://gleasonator.com/tag/antiporn">#antiporn</a> <a class="hashtag" data-tag="gendercritical" href="https://gleasonator.com/tag/gendercritical">#gendercritical</a>. Boosts ≠ endorsements.'
}
note_emojified: 'Fediverse developer. I come in peace. <a class="hashtag" data-tag="vegan" href="https://gleasonator.com/tag/vegan">#vegan</a> <a class="hashtag" data-tag="freeculture" href="https://gleasonator.com/tag/freeculture">#freeculture</a> <a class="hashtag" data-tag="atheist" href="https://gleasonator.com/tag/atheist">#atheist</a> <a class="hashtag" data-tag="antiporn" href="https://gleasonator.com/tag/antiporn">#antiporn</a> <a class="hashtag" data-tag="gendercritical" href="https://gleasonator.com/tag/gendercritical">#gendercritical</a>. Boosts ≠ endorsements.',
},
};
const action = {
type: actions.ACCOUNTS_IMPORT,

View file

@ -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(),
// });
// });
});