Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
fix tests by mocking languages.json url
Browse files Browse the repository at this point in the history
  • Loading branch information
bwindels committed Feb 18, 2019
1 parent 6bf8269 commit 243b170
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = {
"babel"
],
globals: {
LANGUAGES_FILE: "readonly",
LANGUAGES_INDEX_URL: "readonly",
},
env: {
es6: true,
Expand Down
4 changes: 2 additions & 2 deletions src/languageHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,9 +338,9 @@ export function getCurrentLanguage() {

function getLangsJson() {
return new Promise((resolve, reject) => {
// LANGUAGES_FILE is a webpack compile-time define, see webpack config
// LANGUAGES_INDEX_URL is a webpack compile-time define, see webpack config
request(
{ method: "GET", url: require(LANGUAGES_FILE) },
{ method: "GET", url: LANGUAGES_INDEX_URL },
(err, response, body) => {
if (err || response.status < 200 || response.status >= 300) {
reject({err: err, response: response});
Expand Down
1 change: 1 addition & 0 deletions test/i18n-test/languageHandler-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const React = require('react');
const expect = require('expect');
import * as languageHandler from '../../src/languageHandler';
global.LANGUAGES_INDEX_URL = "i18n/languages.json";

const testUtils = require('../test-utils');

Expand Down

0 comments on commit 243b170

Please sign in to comment.