Commit fc48e11f authored by Guilhem CARRON's avatar Guilhem CARRON
Browse files

Merge branch 'fix/test-version-fixed' into 'dev'

Fix(alpha): Fix alpha issue with oauth konnectors !!!

See merge request web-et-numerique/llle_project/ecolyo!492
parents c9dad5d5 c5ffee2c
......@@ -12,7 +12,8 @@ module.exports = {
new webpack.HashedModuleIdsPlugin(),
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'), // to compile on production mode (redux)
'process.env.NODE_ENV': JSON.stringify('production'), // to compile on production mode (redux)
'process.env.IS_ALPHA': JSON.stringify('true'),
__DEVELOPMENT__: false,
__DEVTOOLS__: false,
__STACK_ASSETS__: target !== 'mobile',
......
......@@ -18,6 +18,7 @@ const stackProvidedLibsConfig = {
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.IS_ALPHA': JSON.stringify('true'), //set this variable true for dev so tests runs with alpha variable
__STACK_ASSETS__: true,
}),
],
......
......@@ -33,7 +33,7 @@ const configs = [
require(`cozy-scripts/config/webpack.target.${target}`),
]
if (environment === 'production') {
if (environment === 'production' && process.env.IS_ALPHA !== 'true') {
configs.push(require('cozy-scripts/config/webpack.environment.prod'))
} else {
configs.push(require('./app.config.environment.dev'))
......
......@@ -90,7 +90,7 @@ describe('FeedbackModal functionnalities', () => {
email: 'ecolyo@grandlyon.com',
},
],
subject: '[Ecolyo - alpha] - Feedbacks - feedback.type_bug',
subject: '[Ecolyo] - Feedbacks - feedback.type_bug',
attachments: [],
parts: [
{
......
......@@ -14,19 +14,22 @@ describe('Environement service', () => {
describe('isProduction method', () => {
it('should return true', async () => {
process.env.IS_ALPHA = 'toto'
process.env.NODE_ENV = 'production'
const result = environementService.isProduction()
expect(result).toEqual(true)
})
it('should return false, developement case', async () => {
process.env.IS_ALPHA = 'true'
process.env.NODE_ENV = 'development'
const result = environementService.isProduction()
expect(result).toEqual(false)
})
it('should return false, non existing case', async () => {
process.env.NODE_ENV = 'toto'
it('should return false, alpha case', async () => {
process.env.IS_ALPHA = 'true'
process.env.NODE_ENV = 'production'
const result = environementService.isProduction()
expect(result).toEqual(false)
})
......
export default class EnvironementService {
private getEnvironement() {
return process.env.NODE_ENV
private isAlpha() {
return process.env.IS_ALPHA
}
public isProduction() {
if (this.getEnvironement() === 'production') {
if (this.isAlpha() !== 'true') {
return true
}
return false
}
public getPublicURL() {
if (this.getEnvironement() === 'production') {
if (this.isAlpha() !== 'true') {
return 'https://ecolyo-agent.grandlyon.com'
} else {
return 'https://ecolyo-agent-rec.grandlyon.com'
......
This diff is collapsed.
......@@ -3348,7 +3348,7 @@ browserslist-config-cozy@^0.3.0, browserslist-config-cozy@^0.3.1:
resolved "https://registry.yarnpkg.com/browserslist-config-cozy/-/browserslist-config-cozy-0.3.2.tgz#0a06ed1357480e4e90bbe826aa3159c7e8bc85b3"
integrity sha512-d3wUIrKK8OYUPpgY3FJdb2I3xoDLtia7s2hhNfVUvQMldhw/xivmbtrPlkDdtsOjXa/SXKNhJT45uiS1QOhqVg==
 
browserslist@^4.11.1, browserslist@^4.17.5, browserslist@^4.17.6, browserslist@^4.3.4:
browserslist@^4.11.1, browserslist@^4.17.5, browserslist@^4.18.1, browserslist@^4.3.4:
version "4.18.1"
resolved "https://registry.yarnpkg.com/browserslist/-/browserslist-4.18.1.tgz#60d3920f25b6860eb917c6c7b185576f4d8b017f"
integrity sha512-8ScCzdpPwR2wQh8IT82CA2VgDwjHyqMovPBZSNH54+tm4Jk2pCuv90gmAdH6J84OCRWi0b4gMe6O6XPXuJnjgQ==
......@@ -4512,11 +4512,11 @@ copy-webpack-plugin@6.4.1:
webpack-sources "^1.4.3"
 
core-js-compat@^3.18.0:
version "3.19.1"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.19.1.tgz#fe598f1a9bf37310d77c3813968e9f7c7bb99476"
integrity sha512-Q/VJ7jAF/y68+aUsQJ/afPOewdsGkDtcMb40J8MbuWKlK3Y+wtHq8bTHKPj2WKWLIqmS5JhHs4CzHtz6pT2W6g==
version "3.19.2"
resolved "https://registry.yarnpkg.com/core-js-compat/-/core-js-compat-3.19.2.tgz#18066a3404a302433cb0aa8be82dd3d75c76e5c4"
integrity sha512-ObBY1W5vx/LFFMaL1P5Udo4Npib6fu+cMokeziWkA8Tns4FcDemKF5j9JvaI5JhdkW8EQJQGJN1EcrzmEwuAqQ==
dependencies:
browserslist "^4.17.6"
browserslist "^4.18.1"
semver "7.0.0"
 
core-js-pure@^3.19.0:
......@@ -10754,16 +10754,16 @@ mini-css-extract-plugin@0.5.0:
schema-utils "^1.0.0"
webpack-sources "^1.1.0"
 
minilog@3.1.0:
minilog@3.1.0, "minilog@https://github.com/cozy/minilog.git#master":
version "3.1.0"
resolved "git+https://github.com/cozy/minilog.git#6da0aa58759c4f1a1a7e0fd093dbe2a67c035c55"
resolved "https://github.com/cozy/minilog.git#6da0aa58759c4f1a1a7e0fd093dbe2a67c035c55"
dependencies:
microee "0.0.6"
 
"minilog@https://github.com/cozy/minilog.git#master":
"minilog@git+https://github.com/cozy/minilog.git#master":
version "3.1.0"
uid "6da0aa58759c4f1a1a7e0fd093dbe2a67c035c55"
resolved "https://github.com/cozy/minilog.git#6da0aa58759c4f1a1a7e0fd093dbe2a67c035c55"
resolved "git+https://github.com/cozy/minilog.git#6da0aa58759c4f1a1a7e0fd093dbe2a67c035c55"
dependencies:
microee "0.0.6"
 
......
Markdown is supported
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