Skip to content

Commit

Permalink
deps: Update for for jest 29
Browse files Browse the repository at this point in the history
  • Loading branch information
Betree committed Jan 17, 2024
1 parent 130e141 commit 6c57416
Show file tree
Hide file tree
Showing 12 changed files with 867 additions and 70 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import { t } from 'react-i18next'

import { ReputationGuardTooltip } from '../ReputationGuardTooltip'
Expand Down
2 changes: 1 addition & 1 deletion app/config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ function boolFromConfig(value) {
}

// Get the CF global config
const globals = window.CF_GLOBALS || {}
const globals = (typeof window !== 'undefined' && window.CF_GLOBALS) || {}

// Raw env export
export const JS_ENV = globals['JS_ENV'] || process.env.JS_ENV
Expand Down
4 changes: 4 additions & 0 deletions app/i18n/browser_locale.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@ import { SUPPORTED_LOCALES } from '../constants'

// Util to get browser locale
const navigatorLocale = () => {
if (typeof window === 'undefined') {
return 'en'
}

return window.navigator.userLanguage || window.navigator.language || 'en'
}

Expand Down
4 changes: 4 additions & 0 deletions app/lib/__tests__/url_utils.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/**
* @jest-environment jsdom
*/

import { isExternal, optionsToQueryString, youtubeRegex } from '../url_utils'

describe('Youtube regex', () => {
Expand Down
6 changes: 5 additions & 1 deletion app/state/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ const middlewares = [thunk, promiseMiddleware]

// If running in dev and browser has redux devtools extension activated, use it
const getComposer = () => {
if (JS_ENV === 'prod' || !window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__) {
if (
JS_ENV === 'prod' ||
typeof window === 'undefined' ||
!window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__
) {
return compose
}
return window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__({
Expand Down
24 changes: 12 additions & 12 deletions app/state/modals/__tests__/__snapshots__/reducer.spec.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ exports[`should be able to add and remove modals 1`] = `Immutable.Stack []`;

exports[`should be able to add and remove modals 2`] = `
Immutable.Stack [
Object {
"Modal": Object {
{
"Modal": {
"$$typeof": Symbol(react.memo),
"WrappedComponent": [Function],
"compare": null,
"type": [Function],
},
"props": Object {
"props": {
"hello": "world",
"id": 1,
},
Expand All @@ -21,26 +21,26 @@ Immutable.Stack [

exports[`should be able to add and remove modals 3`] = `
Immutable.Stack [
Object {
"Modal": Object {
{
"Modal": {
"$$typeof": Symbol(react.memo),
"WrappedComponent": [Function],
"compare": null,
"type": [Function],
},
"props": Object {
"props": {
"hello": "world",
"id": 2,
},
},
Object {
"Modal": Object {
{
"Modal": {
"$$typeof": Symbol(react.memo),
"WrappedComponent": [Function],
"compare": null,
"type": [Function],
},
"props": Object {
"props": {
"hello": "world",
"id": 1,
},
Expand All @@ -50,14 +50,14 @@ Immutable.Stack [

exports[`should be able to add and remove modals 4`] = `
Immutable.Stack [
Object {
"Modal": Object {
{
"Modal": {
"$$typeof": Symbol(react.memo),
"WrappedComponent": [Function],
"compare": null,
"type": [Function],
},
"props": Object {
"props": {
"hello": "world",
"id": 1,
},
Expand Down
2 changes: 1 addition & 1 deletion app/state/user_preferences/reducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export const setVideosFilter = createAction('USER_PREFERENCES/SET_VIDEOS_FILTER'
export const toggleAutoscroll = createAction('STATEMENTS/TOGGLE_AUTOSCROLL')
export const toggleBackgroundSound = createAction('STATEMENTS/TOGGLE_BACKGROUND_SOUND')

const isMobile = window.innerWidth <= MOBILE_WIDTH_THRESHOLD
const isMobile = typeof window !== 'undefined' && window.innerWidth <= MOBILE_WIDTH_THRESHOLD

const Preferences = new Record({
// Disable autoscroll and sidebar expended by default on mobile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,8 @@ Immutable.Record {
"id": 739,
"reply_to_id": null,
"is_reported": false,
"user": Object {
"achievements": Array [
"user": {
"achievements": [
4,
3,
6,
Expand All @@ -101,7 +101,7 @@ Immutable.Record {
"speaker_id": null,
"username": "Betree",
},
"source": Object {
"source": {
"language": null,
"site_name": "www.lejdc.fr",
"title": "Sur décision de justice - Alexandre Bain retrouve l'appellation pouilly-fumé",
Expand All @@ -117,8 +117,8 @@ Immutable.Record {
"id": 737,
"reply_to_id": null,
"is_reported": false,
"user": Object {
"achievements": Array [
"user": {
"achievements": [
4,
3,
6,
Expand All @@ -134,14 +134,14 @@ Immutable.Record {
"speaker_id": null,
"username": "Betree",
},
"source": Object {
"source": {
"language": "fr",
"site_name": "FIGARO",
"title": "La justice rend son AOC pouilly-fumé à un vigneron abusivement sanctionné",
"url": "http://www.lefigaro.fr/societes/2017/05/28/20005-20170528ARTFIG00185-la-justice-rend-son-aoc-pouilly-fume-a-un-vigneron-abusivement-sanctionne.php",
},
"statement_id": 297,
"text": "Si l'AOC lui avait bien été retirée (et rendue depuis) la raison invoquée par le Figaro qui cite l'INAO est ailleurs : \\"plusieurs rendez-vous manqués, mais pour des raisons justifiées, avec l'Organisme d'inspection des vins du Centre\\"",
"text": "Si l'AOC lui avait bien été retirée (et rendue depuis) la raison invoquée par le Figaro qui cite l'INAO est ailleurs : "plusieurs rendez-vous manqués, mais pour des raisons justifiées, avec l'Organisme d'inspection des vins du Centre"",
"approve": false,
"inserted_at": 2018-03-13T16:55:07.288Z,
"score": 2,
Expand All @@ -150,8 +150,8 @@ Immutable.Record {
"id": 917,
"reply_to_id": null,
"is_reported": false,
"user": Object {
"achievements": Array [
"user": {
"achievements": [
4,
3,
6,
Expand Down Expand Up @@ -180,8 +180,8 @@ Immutable.Record {
"id": 774,
"reply_to_id": null,
"is_reported": false,
"user": Object {
"achievements": Array [
"user": {
"achievements": [
6,
3,
8,
Expand All @@ -200,7 +200,7 @@ Immutable.Record {
"speaker_id": null,
"username": "tad2018",
},
"source": Object {
"source": {
"language": null,
"site_name": null,
"title": "Planetoscope - Statistiques : Consommation de pesticides phytosanitaires en France",
Expand All @@ -220,8 +220,8 @@ Immutable.Record {
"id": 738,
"reply_to_id": 737,
"is_reported": false,
"user": Object {
"achievements": Array [
"user": {
"achievements": [
4,
3,
6,
Expand All @@ -239,7 +239,7 @@ Immutable.Record {
},
"source": null,
"statement_id": 297,
"text": "\\"l'Inao (Institut national de l'origine et de la qualité) a considéré que le viticulteur refusait de se soumettre à un contrôle obligatoire et a décidé, en 2015, de lui retirer son AOC.\\"",
"text": ""l'Inao (Institut national de l'origine et de la qualité) a considéré que le viticulteur refusait de se soumettre à un contrôle obligatoire et a décidé, en 2015, de lui retirer son AOC."",
"approve": null,
"inserted_at": 2018-03-13T16:55:49.045Z,
"score": 2,
Expand All @@ -250,8 +250,8 @@ Immutable.Record {
"id": 778,
"reply_to_id": 775,
"is_reported": false,
"user": Object {
"achievements": Array [
"user": {
"achievements": [
4,
3,
6,
Expand Down Expand Up @@ -280,8 +280,8 @@ Immutable.Record {
"id": 775,
"reply_to_id": 739,
"is_reported": false,
"user": Object {
"achievements": Array [
"user": {
"achievements": [
6,
3,
8,
Expand Down Expand Up @@ -313,8 +313,8 @@ Immutable.Record {
"id": 809,
"reply_to_id": 778,
"is_reported": false,
"user": Object {
"achievements": Array [
"user": {
"achievements": [
6,
3,
8,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,10 @@ Immutable.Record {

exports[`set presence 2`] = `
Immutable.Record {
"viewers": Object {
"viewers": {
"count": 42,
},
"users": Object {
"users": {
"count": 5,
},
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -211,17 +211,17 @@ Immutable.Record {
"player": "youtube",
"offset": 0,
"playback": Immutable.Record {
"position": Object {
"forcedPosition": Object {
"position": {
"forcedPosition": {
"requestId": 1,
"time": 0,
},
"position": 4,
},
"forcedPosition": Immutable.Record {
"requestId": "A-UNIQUE-UUID",
"time": Object {
"forcedPosition": Object {
"time": {
"forcedPosition": {
"requestId": 1,
"time": 0,
},
Expand Down
Loading

0 comments on commit 6c57416

Please sign in to comment.