Skip to content
Snippets Groups Projects
Commit 05fa5452 authored by Tamlyn Rhodes's avatar Tamlyn Rhodes
Browse files

New authsome mode config

parent eee779cf
No related branches found
No related tags found
1 merge request!120New authsome mode config
Pipeline #2895 passed with stage
in 2 minutes and 9 seconds
...@@ -5,4 +5,7 @@ module.exports = { ...@@ -5,4 +5,7 @@ module.exports = {
visible: true, visible: true,
}, },
}, },
authsome: {
mode: 'fake-mode'
},
} }
import Authsome from 'authsome' import Authsome from 'authsome'
import { connect } from 'react-redux' import { connect } from 'react-redux'
import config from 'config' import config from 'config'
const mode = require(config.authsome.mode)
// higher order component to inject authsome into a component // higher order component to inject authsome into a component
export default function withAuthsome() { export default function withAuthsome() {
const authsome = new Authsome(config.authsome, {}) const authsome = new Authsome({...config.authsome, mode}, {})
function mapState(state) { function mapState(state) {
authsome.context = { authsome.context = {
......
...@@ -3,6 +3,7 @@ import { shallow } from 'enzyme' ...@@ -3,6 +3,7 @@ import { shallow } from 'enzyme'
global.PUBSWEET_COMPONENTS = [] global.PUBSWEET_COMPONENTS = []
jest.mock('fake-mode', () => false, {virtual: true})
const { const {
AuthenticatedComponent, AuthenticatedComponent,
} = require('../../src/components/AuthenticatedComponent') } = require('../../src/components/AuthenticatedComponent')
......
import React from 'react' import React from 'react'
import { shallow } from 'enzyme' import { shallow } from 'enzyme'
import { Authorize } from '../../src/helpers/Authorize' import { Authorize } from '../../src/helpers/Authorize'
jest.mock('fake-mode', () => false, {virtual: true})
global.PUBSWEET_COMPONENTS = [] global.PUBSWEET_COMPONENTS = []
......
...@@ -4,6 +4,7 @@ import configureStore from 'redux-mock-store' ...@@ -4,6 +4,7 @@ import configureStore from 'redux-mock-store'
import Authsome from 'authsome' import Authsome from 'authsome'
import withAuthsome from '../../src/helpers/withAuthsome' import withAuthsome from '../../src/helpers/withAuthsome'
jest.mock('fake-mode', () => false, {virtual: true})
describe('withAuthsome higher order component', () => { describe('withAuthsome higher order component', () => {
const createStore = configureStore() const createStore = configureStore()
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment