edited auth-test
This commit is contained in:
parent
e5937b42e4
commit
7023471abe
|
@ -0,0 +1,15 @@
|
||||||
|
{
|
||||||
|
"vapid_key": "BHczIFh4Wn3Q_7wDgehaB8Ti3Uu8BoyOgXxkOVuEJRuEqxtd9TAno8K9ycz4myiQ1ruiyVfG6xT1JLeXtpxDzUs",
|
||||||
|
"token_type": "Bearer",
|
||||||
|
"client_secret": "cm_8Zip_UYyYq1DPQ-CRFUolrz894MmWYUC0aeVcklM",
|
||||||
|
"redirect_uri": "urn:ietf:wg:oauth:2.0:oob",
|
||||||
|
"created_at": 1594764335,
|
||||||
|
"name": "SoapboxFE_2020-07-14T22:05:17.054Z",
|
||||||
|
"client_id": "bjiy8AxGKXXesfZcyp_iN-uQVE6Cnl03efWoSdOPh9M",
|
||||||
|
"expires_in": 600,
|
||||||
|
"scope": "read write follow push admin",
|
||||||
|
"refresh_token": "IXoCKCsZi3ZCuCjIkeadvEoHRdqOYHklZmv9jvkJ5VA",
|
||||||
|
"website": null,
|
||||||
|
"id": "134",
|
||||||
|
"access_token": "XSkQFSV1R_IvycQmw_uD5z6hQmNyuhh9PtMQbv8TgG8"
|
||||||
|
}
|
|
@ -0,0 +1,8 @@
|
||||||
|
{
|
||||||
|
"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"
|
||||||
|
}
|
|
@ -1,6 +1,8 @@
|
||||||
import reducer from '../auth';
|
import reducer from '../auth';
|
||||||
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
import * as actions from 'soapbox/actions/auth';
|
import * as actions from 'soapbox/actions/auth';
|
||||||
|
// import app from 'soapbox/__fixtures__/app.json';
|
||||||
|
import user from 'soapbox/__fixtures__/user.json';
|
||||||
|
|
||||||
describe('auth reducer', () => {
|
describe('auth reducer', () => {
|
||||||
it('should return the initial state', () => {
|
it('should return the initial state', () => {
|
||||||
|
@ -50,8 +52,59 @@ describe('auth reducer', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Fails with TypeError: cannot read property merge of undefined
|
||||||
|
// it('should handle the Action AUTH_APP_AUTHORIZED', () => {
|
||||||
|
// const state = ImmutableMap({
|
||||||
|
// auth: {
|
||||||
|
// app: {
|
||||||
|
// vapid_key: 'oldVapidKey',
|
||||||
|
// token_type: 'Bearer',
|
||||||
|
// client_secret: 'oldClientSecret',
|
||||||
|
// redirect_uri: 'urn:ietf:wg:oauth:2.0:oob',
|
||||||
|
// created_at: 1594764335,
|
||||||
|
// name: 'SoapboxFE_2020-07-14T22:05:17.054Z',
|
||||||
|
// client_id: 'bjiy8AxGKXXesfZcyp_iN-uQVE6Cnl03efWoSdOPh9M',
|
||||||
|
// expires_in: 600,
|
||||||
|
// scope: 'read write follow push admin',
|
||||||
|
// refresh_token: 'oldRefreshToken',
|
||||||
|
// website: null,
|
||||||
|
// id: '134',
|
||||||
|
// access_token: 'oldAccessToken',
|
||||||
|
// },
|
||||||
|
// },
|
||||||
|
// });
|
||||||
|
// const action = {
|
||||||
|
// type: actions.AUTH_APP_AUTHORIZED,
|
||||||
|
// app: app,
|
||||||
|
// };
|
||||||
|
// expect(reducer(state, action).toJS()).toMatchObject({
|
||||||
|
// app: app,
|
||||||
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
|
it('should handle the Action AUTH_LOGGED_IN', () => {
|
||||||
|
const state = ImmutableMap({
|
||||||
|
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',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
const action = {
|
||||||
|
type: actions.AUTH_LOGGED_IN,
|
||||||
|
user: user,
|
||||||
|
};
|
||||||
|
expect(reducer(state, action).toJS()).toMatchObject({
|
||||||
|
user: user,
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('should handle the Action AUTH_LOGGED_OUT', () => {
|
it('should handle the Action AUTH_LOGGED_OUT', () => {
|
||||||
const state = ImmutableMap({ user: {
|
const state = ImmutableMap({
|
||||||
|
user: {
|
||||||
access_token: 'UVBP2e17b4pTpb_h8fImIm3F5a66IBVb-JkyZHs4gLE',
|
access_token: 'UVBP2e17b4pTpb_h8fImIm3F5a66IBVb-JkyZHs4gLE',
|
||||||
expires_in: 600,
|
expires_in: 600,
|
||||||
me: 'https://social.teci.world/users/curtis',
|
me: 'https://social.teci.world/users/curtis',
|
||||||
|
|
Loading…
Reference in New Issue