More test cleanups (#2506)
* Rename test dirs and remove unused code * Remove unused modules and make coverage accurate
This commit is contained in:
Родитель
41b2987f63
Коммит
daae44ae0a
|
@ -87,7 +87,7 @@ Alternatively, you can start the test runner with a
|
|||
[specific file or regular expression](https://facebook.github.io/jest/docs/en/cli.html#jest-regexfortestfiles),
|
||||
like:
|
||||
```
|
||||
yarn test tests/client/amo/components/TestAddonDetail.js
|
||||
yarn test tests/unit/amo/components/TestAddonDetail.js
|
||||
```
|
||||
|
||||
#### Run all tests
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
module.exports = {
|
||||
collectCoverageFrom: ['src/**/*.{js,jsx}'],
|
||||
coveragePathIgnorePatterns: [
|
||||
'<rootDir>/node_modules/',
|
||||
'<rootDir>/src/core/server/webpack-isomorphic-tools-config.js',
|
||||
'<rootDir>/tests/',
|
||||
'<rootDir>/config/',
|
||||
'<rootDir>/src/locale/',
|
||||
],
|
||||
moduleDirectories: [
|
||||
'src',
|
||||
|
|
|
@ -174,9 +174,7 @@
|
|||
"babel-preset-stage-2": "^6.24.1",
|
||||
"babel-register": "^6.24.1",
|
||||
"bundle-loader": "^0.5.5",
|
||||
"chai": "^3.5.0",
|
||||
"chalk": "^1.1.3",
|
||||
"cheerio": "^0.22.0",
|
||||
"chokidar-cli": "^1.2.0",
|
||||
"concurrently": "^3.4.0",
|
||||
"content-security-policy-parser": "^0.1.0",
|
||||
|
|
|
@ -1,45 +0,0 @@
|
|||
import cheerio from 'cheerio';
|
||||
import { camelizeKeys as camelCaseKeys } from 'humps';
|
||||
|
||||
import { runServer } from 'core/server/base';
|
||||
|
||||
export function checkSRI(res) {
|
||||
const $ = cheerio.load(res.text);
|
||||
const $stylesheets = $('link[rel=stylesheet]');
|
||||
expect($stylesheets.length > 0).toBeTruthy();
|
||||
$stylesheets.each((i, elem) => {
|
||||
const $elem = $(elem);
|
||||
expect($elem.attr('integrity')).toContain('sha512');
|
||||
expect($elem.attr('crossorigin')).toEqual('anonymous');
|
||||
});
|
||||
|
||||
const $script = $('script[src]');
|
||||
expect($script.length > 0).toBeTruthy();
|
||||
$script.each((i, elem) => {
|
||||
const $elem = $(elem);
|
||||
if ($elem.attr('src').includes('analytics.js')) {
|
||||
throw new Error('Google analytics should not be included in server tests.');
|
||||
}
|
||||
expect($elem.attr('integrity')).toContain('sha512');
|
||||
expect($elem.attr('crossorigin')).toEqual('anonymous');
|
||||
});
|
||||
}
|
||||
|
||||
export function parseCSP(rawCsp) {
|
||||
return camelCaseKeys(
|
||||
rawCsp
|
||||
.split(';')
|
||||
.map((part) => part.trim().split(' '))
|
||||
.reduce((parts, [partName, ...partValues]) => ({
|
||||
...parts,
|
||||
[partName]: partValues,
|
||||
}), {}));
|
||||
}
|
||||
|
||||
export function runTestServer(options = {}) {
|
||||
return runServer({
|
||||
listen: false,
|
||||
exitProcess: false,
|
||||
...options,
|
||||
});
|
||||
}
|
|
@ -1,22 +0,0 @@
|
|||
import { oneLine } from 'common-tags';
|
||||
|
||||
import { parseCSP } from './helpers';
|
||||
|
||||
describe('server test helpers', () => {
|
||||
describe('parseCSP', () => {
|
||||
it('parses the CSP header into an object', () => {
|
||||
const headerContent = oneLine`default-src 'none'; base-uri 'self'; child-src 'none';
|
||||
connect-src 'self' https://addons-dev-cdn.allizom.org 127.0.0.1:3001; form-action 'none';
|
||||
frame-src 'none'; img-src 'self' 127.0.0.1:3001; media-src
|
||||
https://addons-discovery.cdn.mozilla.net; object-src 'none'; script-src 'self'
|
||||
https://addons-dev-cdn.allizom.org 127.0.0.1:3001; style-src 'self' blob:
|
||||
'sha256-8VVSrUT/1AZpxCZNGwNROSnacmbseuppeBCace7a/Wc='; report-uri /__cspreport__`;
|
||||
const policy = parseCSP(headerContent);
|
||||
expect(policy.imgSrc).toEqual(["'self'", '127.0.0.1:3001']);
|
||||
expect(policy.styleSrc).toEqual(
|
||||
["'self'", 'blob:', "'sha256-8VVSrUT/1AZpxCZNGwNROSnacmbseuppeBCace7a/Wc='"]
|
||||
);
|
||||
expect(policy.reportUri).toEqual(['/__cspreport__']);
|
||||
});
|
||||
});
|
||||
});
|
|
@ -5,7 +5,7 @@ import {
|
|||
setAddonReviews,
|
||||
} from 'amo/actions/reviews';
|
||||
import { SET_REVIEW } from 'amo/constants';
|
||||
import { fakeAddon, fakeReview } from 'tests/client/amo/helpers';
|
||||
import { fakeAddon, fakeReview } from 'tests/unit/amo/helpers';
|
||||
|
||||
// See reducer tests for more coverage of review actions.
|
||||
describe('amo.actions.reviews', () => {
|
|
@ -14,8 +14,8 @@ import {
|
|||
INCOMPATIBLE_NOT_FIREFOX,
|
||||
INCOMPATIBLE_UNDER_MIN_VERSION,
|
||||
} from 'core/constants';
|
||||
import { signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { signedInApiState } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
|
||||
|
|
@ -26,8 +26,8 @@ import {
|
|||
} from 'core/constants';
|
||||
import InstallButton from 'core/components/InstallButton';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { fakeAddon, signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { fakeAddon, signedInApiState } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
function renderProps({ addon = fakeAddon, setCurrentStatus = sinon.spy(), ...customProps } = {}) {
|
|
@ -7,8 +7,8 @@ import { findDOMNode } from 'react-dom';
|
|||
|
||||
import AddonMeta from 'amo/components/AddonMeta';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { fakeAddon } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { fakeAddon } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
function render({ ...customProps } = {}) {
|
||||
const props = {
|
|
@ -9,8 +9,8 @@ import { Provider } from 'react-redux';
|
|||
|
||||
import createStore from 'amo/store';
|
||||
import { AddonMoreInfoBase } from 'amo/components/AddonMoreInfo';
|
||||
import { fakeAddon } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { fakeAddon } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<AddonMoreInfo />', () => {
|
|
@ -14,8 +14,8 @@ import {
|
|||
mapDispatchToProps, mapStateToProps, AddonReviewBase,
|
||||
} from 'amo/components/AddonReview';
|
||||
import { ErrorHandler } from 'core/errorHandler';
|
||||
import { fakeAddon, fakeReview, signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { fakeAddon, fakeReview, signedInApiState } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
const defaultReview = {
|
||||
id: 3321, addonId: fakeAddon.id, addonSlug: fakeAddon.slug, rating: 5,
|
|
@ -26,10 +26,10 @@ import { denormalizeAddon } from 'core/reducers/addons';
|
|||
import { initialApiState } from 'core/reducers/api';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import Rating from 'ui/components/Rating';
|
||||
import { fakeAddon, fakeReview } from 'tests/client/amo/helpers';
|
||||
import { fakeAddon, fakeReview } from 'tests/unit/amo/helpers';
|
||||
import {
|
||||
apiResponsePage, getFakeI18nInst, unexpectedSuccess,
|
||||
} from 'tests/client/helpers';
|
||||
} from 'tests/unit/helpers';
|
||||
|
||||
function getLoadedReviews({
|
||||
addonSlug = fakeAddon.slug, reviews = [fakeReview], reviewCount = 1 } = {},
|
|
@ -2,7 +2,7 @@ import React from 'react';
|
|||
|
||||
import AddonsCard from 'amo/components/AddonsCard';
|
||||
import SearchResult from 'amo/components/SearchResult';
|
||||
import { shallowRender } from 'tests/client/helpers';
|
||||
import { shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<AddonsCard />', () => {
|
|
@ -11,7 +11,7 @@ import { CategoriesBase, mapStateToProps } from 'amo/components/Categories';
|
|||
import { setClientApp, setLang } from 'core/actions';
|
||||
import { categoriesLoad } from 'core/actions/categories';
|
||||
import { ADDON_TYPE_EXTENSION, CLIENT_APP_ANDROID } from 'core/constants';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
const categoriesResponse = {
|
|
@ -7,8 +7,8 @@ import {
|
|||
} from 'amo/components/FeaturedAddons';
|
||||
import createStore from 'amo/store';
|
||||
import { ADDON_TYPE_EXTENSION, ADDON_TYPE_THEME } from 'core/constants';
|
||||
import { fakeAddon, signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst, shallowRender } from 'tests/client/helpers';
|
||||
import { fakeAddon, signedInApiState } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst, shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<FeaturedAddons />', () => {
|
|
@ -8,7 +8,7 @@ import { Provider } from 'react-redux';
|
|||
|
||||
import Footer from 'amo/components/Footer';
|
||||
import createStore from 'amo/store';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
|
||||
|
|
@ -17,8 +17,8 @@ import {
|
|||
} from 'core/constants';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { visibleAddonType } from 'core/utils';
|
||||
import { fakeAddon } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst, shallowRender } from 'tests/client/helpers';
|
||||
import { fakeAddon } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst, shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<LandingPage />', () => {
|
|
@ -12,7 +12,7 @@ import {
|
|||
LanguagePickerBase,
|
||||
changeLocaleURL,
|
||||
} from 'amo/components/LanguagePicker';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('LanguagePicker', () => {
|
|
@ -8,7 +8,7 @@ import { Provider } from 'react-redux';
|
|||
|
||||
import createStore from 'amo/store';
|
||||
import { MastHeadBase } from 'amo/components/MastHead';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
import translate from 'core/i18n/translate';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
|
|
@ -11,8 +11,8 @@ import NotAuthorized from 'amo/components/ErrorPage/NotAuthorized';
|
|||
import createStore from 'amo/store';
|
||||
import { createApiError } from 'core/api';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { signedInApiState } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<NotAuthorized />', () => {
|
|
@ -11,8 +11,8 @@ import NotFound from 'amo/components/ErrorPage/NotFound';
|
|||
import createStore from 'amo/store';
|
||||
import { createApiError } from 'core/api';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { signedInApiState } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<NotFound />', () => {
|
|
@ -23,8 +23,8 @@ import {
|
|||
} from 'amo/components/RatingManager';
|
||||
import {
|
||||
fakeAddon, fakeReview, signedInApiState,
|
||||
} from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst, userAuthToken } from 'tests/client/helpers';
|
||||
} from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst, userAuthToken } from 'tests/unit/helpers';
|
||||
|
||||
function render(customProps = {}) {
|
||||
const props = {
|
|
@ -3,7 +3,7 @@ import { renderIntoDocument } from 'react-addons-test-utils';
|
|||
import { PhotoSwipeGallery } from 'react-photoswipe';
|
||||
|
||||
import ScreenShots, { thumbnailContent } from 'amo/components/ScreenShots';
|
||||
import { shallowRender } from 'tests/client/helpers';
|
||||
import { shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
describe('<ScreenShots />', () => {
|
||||
const previews = [
|
|
@ -8,7 +8,7 @@ import {
|
|||
mapDispatchToProps,
|
||||
mapStateToProps,
|
||||
} from 'amo/components/SearchForm';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<SearchForm />', () => {
|
|
@ -4,7 +4,7 @@ import SearchPage from 'amo/components/SearchPage';
|
|||
import SearchResults from 'amo/components/SearchResults';
|
||||
import SearchSort from 'amo/components/SearchSort';
|
||||
import Paginate from 'core/components/Paginate';
|
||||
import { findAllByTag, findByTag, shallowRender } from 'tests/client/helpers';
|
||||
import { findAllByTag, findByTag, shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<SearchPage />', () => {
|
|
@ -10,8 +10,8 @@ import { Provider } from 'react-redux';
|
|||
import createStore from 'amo/store';
|
||||
import SearchResult from 'amo/components/SearchResult';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { fakeAddon } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { fakeAddon } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
import { ADDON_TYPE_THEME } from 'core/constants';
|
||||
|
||||
|
|
@ -8,8 +8,8 @@ import { Provider } from 'react-redux';
|
|||
import createStore from 'amo/store';
|
||||
import SearchResults from 'amo/components/SearchResults';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { fakeAddon } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { fakeAddon } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<SearchResults />', () => {
|
|
@ -10,7 +10,7 @@ import { Provider } from 'react-redux';
|
|||
import createStore from 'amo/store';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import SearchSort from 'amo/components/SearchSort';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
function render(props) {
|
|
@ -11,8 +11,8 @@ import ServerError from 'amo/components/ErrorPage/ServerError';
|
|||
import createStore from 'amo/store';
|
||||
import { createApiError } from 'core/api';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { signedInApiState } from 'tests/unit/amo/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<ServerError />', () => {
|
|
@ -9,7 +9,7 @@ import { Provider } from 'react-redux';
|
|||
import SuggestedPages from 'amo/components/SuggestedPages';
|
||||
import createStore from 'amo/store';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<SuggestedPages />', () => {
|
|
@ -23,7 +23,7 @@ import { createApiError } from 'core/api';
|
|||
import DefaultErrorPage from 'core/components/ErrorPage';
|
||||
import { INSTALL_STATE, maximumSetTimeoutDelay } from 'core/constants';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { getFakeI18nInst, userAuthToken } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst, userAuthToken } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('App', () => {
|
|
@ -4,7 +4,7 @@ import { CategoryPageBase, mapStateToProps } from 'amo/containers/CategoryPage';
|
|||
import createStore from 'amo/store';
|
||||
import { searchStart } from 'core/actions/search';
|
||||
import { ADDON_TYPE_THEME } from 'core/constants';
|
||||
import { shallowRender } from 'tests/client/helpers';
|
||||
import { shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('CategoryPage', () => {
|
|
@ -3,8 +3,8 @@ import React from 'react';
|
|||
import { DetailPageBase, mapStateToProps } from 'amo/containers/DetailPage';
|
||||
import AddonDetail from 'amo/components/AddonDetail';
|
||||
import { INSTALLED, UNKNOWN } from 'core/constants';
|
||||
import { fakeAddon } from 'tests/client/amo/helpers';
|
||||
import { shallowRender } from 'tests/client/helpers';
|
||||
import { fakeAddon } from 'tests/unit/amo/helpers';
|
||||
import { shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('DetailPage', () => {
|
|
@ -7,7 +7,7 @@ import {
|
|||
import { Provider } from 'react-redux';
|
||||
|
||||
import createStore from 'amo/store';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
import Home from 'amo/containers/Home';
|
||||
|
||||
|
|
@ -6,7 +6,7 @@ import {
|
|||
parsePage,
|
||||
} from 'core/searchUtils';
|
||||
import * as api from 'core/api';
|
||||
import { signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { signedInApiState } from 'tests/unit/amo/helpers';
|
||||
|
||||
describe('Search.mapStateToProps()', () => {
|
||||
const state = {
|
|
@ -1,6 +1,6 @@
|
|||
import { setAddonReviews, setReview } from 'amo/actions/reviews';
|
||||
import reviews, { initialState } from 'amo/reducers/reviews';
|
||||
import { fakeAddon, fakeReview } from 'tests/client/amo/helpers';
|
||||
import { fakeAddon, fakeReview } from 'tests/unit/amo/helpers';
|
||||
|
||||
describe('amo.reducers.reviews', () => {
|
||||
function setFakeReview({
|
|
@ -4,8 +4,8 @@ import {
|
|||
submitReview,
|
||||
} from 'amo/api';
|
||||
import * as api from 'core/api';
|
||||
import { unexpectedSuccess } from 'tests/client/helpers';
|
||||
import { fakeReview, signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { unexpectedSuccess } from 'tests/unit/helpers';
|
||||
import { fakeReview, signedInApiState } from 'tests/unit/amo/helpers';
|
||||
|
||||
describe('amo.api', () => {
|
||||
let mockApi;
|
|
@ -17,7 +17,7 @@ import {
|
|||
loadFeaturedAddons,
|
||||
loadLandingAddons,
|
||||
} from 'amo/utils';
|
||||
import { unexpectedSuccess } from 'tests/client/helpers';
|
||||
import { unexpectedSuccess } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('amo/utils', () => {
|
|
@ -5,7 +5,7 @@ import {
|
|||
INSTALL_EVENT_LIST,
|
||||
SET_ENABLE_NOT_AVAILABLE,
|
||||
} from 'core/constants';
|
||||
import { unexpectedSuccess } from 'tests/client/helpers';
|
||||
import { unexpectedSuccess } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('addonManager', () => {
|
|
@ -34,7 +34,7 @@ import {
|
|||
} from 'core/constants';
|
||||
import {
|
||||
getFakeAddonManagerWrapper, shallowRender,
|
||||
} from 'tests/client/helpers';
|
||||
} from 'tests/unit/helpers';
|
||||
import * as installAddon from 'core/installAddon';
|
||||
import * as themePreview from 'core/themePreview';
|
||||
|
|
@ -1,5 +1,5 @@
|
|||
import createLocalState, { configureLocalForage } from 'core/localState';
|
||||
import { unexpectedSuccess } from 'tests/client/helpers';
|
||||
import { unexpectedSuccess } from 'tests/unit/helpers';
|
||||
|
||||
function fakeLocalForage(overrides = {}) {
|
||||
return {
|
|
@ -1,5 +1,5 @@
|
|||
import * as actions from 'core/actions';
|
||||
import { userAgents } from 'tests/client/helpers';
|
||||
import { userAgents } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('core actions setAuthToken', () => {
|
|
@ -8,7 +8,7 @@ import * as api from 'core/api';
|
|||
import { ADDON_TYPE_THEME } from 'core/constants';
|
||||
import { ErrorHandler } from 'core/errorHandler';
|
||||
import { signedInApiState, unexpectedSuccess, userAuthToken }
|
||||
from 'tests/client/helpers';
|
||||
from 'tests/unit/helpers';
|
||||
|
||||
|
||||
export function generateHeaders(
|
|
@ -14,7 +14,7 @@ import {
|
|||
mapStateToProps,
|
||||
} from 'core/components/AuthenticateButton';
|
||||
import apiReducer from 'core/reducers/api';
|
||||
import { getFakeI18nInst, userAuthToken } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst, userAuthToken } from 'tests/unit/helpers';
|
||||
import Icon from 'ui/components/Icon';
|
||||
|
||||
function createStore() {
|
|
@ -10,9 +10,9 @@ import { loadFail } from 'redux-connect/lib/store';
|
|||
import ErrorPage, { mapStateToProps } from 'core/components/ErrorPage';
|
||||
import createStore from 'amo/store';
|
||||
import { createApiError } from 'core/api';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { signedInApiState } from 'tests/client/amo/helpers';
|
||||
import { signedInApiState } from 'tests/unit/amo/helpers';
|
||||
|
||||
|
||||
describe('<ErrorPage />', () => {
|
|
@ -13,8 +13,8 @@ import {
|
|||
UNKNOWN,
|
||||
} from 'core/constants';
|
||||
import * as themePreview from 'core/themePreview';
|
||||
import { getFakeI18nInst, shallowRender } from 'tests/client/helpers';
|
||||
import { fakeAddon } from 'tests/client/amo/helpers';
|
||||
import { getFakeI18nInst, shallowRender } from 'tests/unit/helpers';
|
||||
import { fakeAddon } from 'tests/unit/amo/helpers';
|
||||
import Button from 'ui/components/Button';
|
||||
|
||||
|
|
@ -19,7 +19,7 @@ import {
|
|||
UNKNOWN,
|
||||
} from 'core/constants';
|
||||
import * as themePreview from 'core/themePreview';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<InstallSwitch />', () => {
|
|
@ -1,7 +1,7 @@
|
|||
import React from 'react';
|
||||
import { Link } from 'react-router';
|
||||
|
||||
import { shallowRender } from 'tests/client/helpers';
|
||||
import { shallowRender } from 'tests/unit/helpers';
|
||||
import { NavBar, NavBarButton, NavBarItem, NavBarLink } from 'core/components/NavBar';
|
||||
|
||||
describe('<NavBarItem />', () => {
|
|
@ -11,7 +11,7 @@ import { Route, Router, createMemoryHistory } from 'react-router';
|
|||
|
||||
import Paginate from 'core/components/Paginate';
|
||||
import PaginatorLink from 'core/components/PaginatorLink';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('<Paginate />', () => {
|
|
@ -12,7 +12,7 @@ import HandleLogin, {
|
|||
} from 'core/containers/HandleLogin';
|
||||
import { setAuthToken } from 'core/actions';
|
||||
import * as api from 'core/api';
|
||||
import { userAuthToken } from 'tests/client/helpers';
|
||||
import { userAuthToken } from 'tests/unit/helpers';
|
||||
|
||||
describe('<HandleLogin />', () => {
|
||||
function render(store, location, router) {
|
|
@ -5,7 +5,7 @@ import { Simulate, renderIntoDocument } from 'react-addons-test-utils';
|
|||
import ReactDOM, { findDOMNode } from 'react-dom';
|
||||
|
||||
import { InfoDialogBase, ShowInfoDialog, mapStateToProps } from 'core/containers/InfoDialog';
|
||||
import { getFakeI18nInst, shallowRender } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst, shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
let closeAction;
|
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
import { mapStateToProps, LoginRequiredBase }
|
||||
from 'core/containers/LoginRequired';
|
||||
import LoginPage from 'core/components/LoginPage';
|
||||
import { shallowRender } from 'tests/client/helpers';
|
||||
import { shallowRender } from 'tests/unit/helpers';
|
||||
|
||||
describe('<LoginRequired />', () => {
|
||||
class MyComponent extends React.Component {
|
|
@ -5,7 +5,7 @@ import {
|
|||
} from 'react-addons-test-utils';
|
||||
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('I18nProvider', () => {
|
|
@ -8,7 +8,7 @@ import {
|
|||
|
||||
import I18nProvider from 'core/i18n/Provider';
|
||||
import translate from 'core/i18n/translate';
|
||||
import { getFakeI18nInst } from 'tests/client/helpers';
|
||||
import { getFakeI18nInst } from 'tests/unit/helpers';
|
||||
|
||||
|
||||
class OuterComponent extends React.Component {
|
|
@ -3,7 +3,7 @@ import UAParser from 'ua-parser-js';
|
|||
import * as actions from 'core/actions';
|
||||
import api, { initialApiState } from 'core/reducers/api';
|
||||
import { signedInApiState, userAgents, userAuthToken }
|
||||
from 'tests/client/helpers';
|
||||
from 'tests/unit/helpers';
|
||||
|
||||
|
||||
describe('api reducer', () => {
|
|
@ -2,7 +2,7 @@ import base64url from 'base64url';
|
|||
|
||||
import { setAuthToken } from 'core/actions';
|
||||
import auth from 'core/reducers/authentication';
|
||||
import { userAuthToken } from 'tests/client/helpers';
|
||||
import { userAuthToken } from 'tests/unit/helpers';
|
||||
|
||||
describe('authentication reducer', () => {
|
||||
it('defaults to an empty object', () => {
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче