Skip to content

Commit

Permalink
Reorganize ExperimentRowCard component into bundle directory
Browse files Browse the repository at this point in the history
  • Loading branch information
lmorchard committed Sep 15, 2017
1 parent e73f2fe commit 16b1aa4
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import classnames from 'classnames';
import { Localized } from 'fluent-react/compat';
import React from 'react';

import { buildSurveyURL, experimentL10nId } from '../lib/utils';
import { buildSurveyURL, experimentL10nId } from '../../lib/utils';

import type { InstalledExperiments } from '../reducers/addon';
import type { InstalledExperiments } from '../../reducers/addon';

import ExperimentPlatforms from './ExperimentPlatforms';
import ExperimentPlatforms from '../ExperimentPlatforms';

const ONE_DAY = 24 * 60 * 60 * 1000;
const ONE_WEEK = 7 * ONE_DAY;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { storiesOf } from '@storybook/react';
import { action } from '@storybook/addon-actions';
import { withKnobs, object, boolean } from '@storybook/addon-knobs';

import ExperimentRowCard from '../../../src/app/components/ExperimentRowCard';
import LayoutWrapper from '../../../src/app/components/LayoutWrapper';
import ExperimentRowCard from './index';
import LayoutWrapper from '..//LayoutWrapper';

const ONE_DAY = 24 * 60 * 60 * 1000;
const ONE_WEEK = 7 * ONE_DAY;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
/* global describe, beforeEach, it */
import React from 'react';
import { expect } from 'chai';
import sinon from 'sinon';
import { shallow } from 'enzyme';
import { findLocalizedById } from '../util';
import moment from 'moment';
import { findLocalizedById } from '../../../../test/app/util';

import ExperimentRowCard from '../../../src/app/components/ExperimentRowCard';
import ExperimentRowCard from './index';

describe('app/components/ExperimentRowCard', () => {
let mockExperiment, mockClickEvent, props, subject;
Expand Down Expand Up @@ -112,7 +113,7 @@ describe('app/components/ExperimentRowCard', () => {

subject.setProps({
enabled: false,
getExperimentLastSeen: sinon.spy(experiment => moment().valueOf())
getExperimentLastSeen: sinon.spy(() => moment().valueOf())
});

expect(props.getExperimentLastSeen.called).to.be.true;
Expand All @@ -127,7 +128,7 @@ describe('app/components/ExperimentRowCard', () => {
props = { ...props,
enabled: false,
getExperimentLastSeen:
sinon.spy(experiment => moment().subtract(1.5, 'week').valueOf()),
sinon.spy(() => moment().subtract(1.5, 'week').valueOf()),
experiment: { ...mockExperiment,
modified: moment().subtract(1, 'week').utc()
}
Expand All @@ -145,7 +146,7 @@ describe('app/components/ExperimentRowCard', () => {

subject.setProps({
enabled: false,
getExperimentLastSeen: sinon.spy(experiment => moment().valueOf())
getExperimentLastSeen: sinon.spy(() => moment().valueOf())
});

expect(props.getExperimentLastSeen.called).to.be.true;
Expand All @@ -157,15 +158,15 @@ describe('app/components/ExperimentRowCard', () => {
expect(findLocalizedById(subject, 'experimentListEndingTomorrow')).to.have.property('length', 0);
subject.setProps({ experiment: { ...mockExperiment,
completed: moment().add(23, 'hours').utc()
}});
} });
expect(findLocalizedById(subject, 'experimentListEndingTomorrow')).to.have.property('length', 1);
});

it('should show a "soon" status message when ending in one week', () => {
expect(findLocalizedById(subject, 'experimentListEndingSoon')).to.have.property('length', 0);
subject.setProps({ experiment: { ...mockExperiment,
completed: moment().add(6, 'days').utc()
}});
} });
expect(findLocalizedById(subject, 'experimentListEndingSoon')).to.have.property('length', 1);
});

Expand Down Expand Up @@ -198,7 +199,7 @@ describe('app/components/ExperimentRowCard', () => {
hasAddon: true
});
expect(findLocalizedById(subject, 'experimentCardManage')).to.have.property('length', 1);
})
});

it('should ping GA when manage is clicked', () => {
subject.find('.experiment-summary').simulate('click', mockClickEvent);
Expand Down

0 comments on commit 16b1aa4

Please sign in to comment.