Skip to content

Commit

Permalink
Merge pull request #250 from appfolio/update-tests
Browse files Browse the repository at this point in the history
Tweak test imports
  • Loading branch information
gthomas-appfolio authored Jun 30, 2017
2 parents d31c5ae + 67075cf commit 4020d6b
Show file tree
Hide file tree
Showing 51 changed files with 41 additions and 122 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"scripts": {
"lint": "eslint src; exit 0",
"start": "BABEL_ENV=storybook start-storybook -p 6006 -s ./public",
"test": "NODE_ENV=test nyc --reporter text --reporter lcov mocha --recursive --timeout 10000 --compilers js:babel-register --require ignore-styles",
"test": "NODE_ENV=test nyc --reporter text --reporter lcov mocha",
"docs": "BABEL_ENV=storybook build-storybook -o docs",
"version": "npm run docs && git add -A docs",
"dist": "webpack -p",
Expand Down
6 changes: 6 additions & 0 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ import DeletedNote from './components/DeletedNote.js';
import EditableNote from './components/EditableNote.js';
import ExpandableSection from './components/ExpandableSection.js';
import FeatureBanner from './components/FeatureBanner.js';
import FileInput from './components/FileInput.js';
import FilterList from './components/FilterList.js';
import FormChoice from './components/FormChoice.js';
import FormRow from './components/FormRow.js';
Expand All @@ -100,8 +101,10 @@ import Notes from './components/Notes.js';
import Paginator from './components/Paginator';
import PatternInput from './components/PatternInput.js';
import Progress from './components/Progress.js';
import RadioInput from './components/RadioInput.js';
import Select from './components/Select.js';
import Spinner from './components/Spinner.js';
import StaticInput from './components/StaticInput.js';
import Steps from './components/Steps.js';
import SummaryBox from './components/SummaryBox.js';
import SummaryBoxItem from './components/SummaryBoxItem.js';
Expand Down Expand Up @@ -141,6 +144,7 @@ export {
DeletedNote,
EditableNote,
Fade,
FileInput,
Form,
FormFeedback,
FormGroup,
Expand Down Expand Up @@ -215,7 +219,9 @@ export {
Notes,
PatternInput,
Progress,
RadioInput,
Spinner,
StaticInput,
Steps,
SummaryBox,
SummaryBoxItem,
Expand Down
5 changes: 5 additions & 0 deletions test/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"env": {
"mocha": true
}
}
1 change: 0 additions & 1 deletion test/components/Address.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { shallow } from 'enzyme';
Expand Down
7 changes: 1 addition & 6 deletions test/components/Alert.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import 'jsdom-global/register';

/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount, shallow } from 'enzyme';
import { Icon } from '../../src/';

import Alert from '../../src/components/Alert';
import { Icon, Alert } from '../../src';

import { Alert as Inner } from 'reactstrap';

Expand Down
6 changes: 1 addition & 5 deletions test/components/BlockPanel.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
/* eslint-env mocha */

import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
import { Button, CardBlock, CardTitle, Icon } from '../../src';
import { Button, CardBlock, CardTitle, Icon, BlockPanel } from '../../src';
import { mount, shallow } from 'enzyme';


import BlockPanel from '../../src/components/BlockPanel.js';

describe('<BlockPanel />', () => {
context('is expandable', () => {
it('should be open by default', () => {
Expand Down
7 changes: 1 addition & 6 deletions test/components/BoundForm.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import sinon from 'sinon';
import assert from 'assert';
import { shallow } from 'enzyme';

import { Input } from 'reactstrap';

import BoundForm from '../../src/components/BoundForm';
import BoundFormRow from '../../src/components/BoundFormRow';
import FormChoice from '../../src/components/FormChoice';
import { BoundForm } from '../../src';

describe('<BoundForm />', () => {
const data = {
Expand Down
3 changes: 1 addition & 2 deletions test/components/BoundFormRow.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import sinon from 'sinon';
import assert from 'assert';
import { shallow } from 'enzyme';

import BoundFormRow from '../../src/components/BoundFormRow';
import { BoundFormRow } from '../../src';

/* eslint-env mocha */
describe('<BoundFormRow />', () => {
describe('with context', () => {
const onChange = sinon.stub();
Expand Down
3 changes: 1 addition & 2 deletions test/components/Calendar.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
import sinon from 'sinon';
import { Calendar } from '../../src';
import addWeeks from 'date-fns/add_weeks';
import endOfWeek from 'date-fns/end_of_week';
import isSameDay from 'date-fns/is_same_day';
import startOfMonth from 'date-fns/start_of_month';
import startOfWeek from 'date-fns/start_of_week';
import { Calendar } from '../../src';

describe('<Calendar />', () => {
it('should render correctly', () => {
Expand Down
4 changes: 1 addition & 3 deletions test/components/Callout.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
/* eslint-env mocha */

import React from 'react';
import assert from 'assert';
import { Callout } from '../../src';
import { mount } from 'enzyme';
import { Callout } from '../../src';

describe('<Callout />', () => {
it('should render correctly', () => {
Expand Down
1 change: 0 additions & 1 deletion test/components/CheckboxBooleanInput.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import sinon from 'sinon';
import assert from 'assert';
Expand Down
1 change: 0 additions & 1 deletion test/components/CheckboxInput.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { shallow } from 'enzyme';
Expand Down
4 changes: 1 addition & 3 deletions test/components/CheckboxListInput.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import sinon from 'sinon';
import assert from 'assert';
import { shallow } from 'enzyme';

import CheckboxListInput from '../../src/components/CheckboxListInput';
import FormChoice from '../../src/components/FormChoice';
import { CheckboxListInput, FormChoice } from '../../src';

describe('<CheckboxListInput />', () => {
let onChange = sinon.stub();
Expand Down
3 changes: 0 additions & 3 deletions test/components/Close.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */

import 'jsdom-global/register';
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
Expand Down
4 changes: 1 addition & 3 deletions test/components/CreditCardExpiration.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
import sinon from 'sinon';

import { Select } from '../../src/';
import CreditCardExpiration from '../../src/components/CreditCardExpiration';
import { Select, CreditCardExpiration } from '../../src';

describe('<CreditCardExpiration />', () => {
const today = new Date();
Expand Down
4 changes: 1 addition & 3 deletions test/components/CreditCardNumber.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount, shallow } from 'enzyme';
import sinon from 'sinon';

import CreditCardNumber from '../../src/components/CreditCardNumber';
import Icon from '../../src/components/Icon';
import { CreditCardNumber, Icon } from '../../src';

const EXAMPLES = {
'american-express': '378282246310005',
Expand Down
1 change: 0 additions & 1 deletion test/components/CurrencyInput.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
Expand Down
3 changes: 1 addition & 2 deletions test/components/Datapair.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { shallow } from 'enzyme';
import { Col } from 'reactstrap';

import Datapair from '../../src/components/Datapair';
import { Datapair } from '../../src';

describe('<Datapair />', () => {
const component = shallow(<Datapair label="stuff" value="something" />);
Expand Down
1 change: 0 additions & 1 deletion test/components/DateInput.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
Expand Down
6 changes: 1 addition & 5 deletions test/components/DateMonth.spec.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
/* eslint-env mocha */

import 'jsdom-global/register';
import React from 'react';
import assert from 'assert';
import { mount, shallow } from 'enzyme';
import { mount } from 'enzyme';

import { DateMonth } from '../../src';

Expand Down
1 change: 0 additions & 1 deletion test/components/DeletedNote.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
Expand Down
1 change: 0 additions & 1 deletion test/components/EditableNote.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
Expand Down
4 changes: 1 addition & 3 deletions test/components/ExpandableSection.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
/* eslint-env mocha */

import React from 'react';
import assert from 'assert';
import { shallow } from 'enzyme';

import ExpandableSection from '../../src/components/ExpandableSection.js';
import { ExpandableSection } from '../../src';

describe('<ExpandableSection />', () => {
it('should be closed by default', () => {
Expand Down
1 change: 0 additions & 1 deletion test/components/FeatureBanner.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
Expand Down
6 changes: 1 addition & 5 deletions test/components/FileInput.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,8 @@ import { shallow } from 'enzyme';
import sinon from 'sinon';
import assert from 'assert';
import { Input } from 'reactstrap';
import { FileInput } from '../../src';

import FileInput from '../../src/components/FileInput';

class MockFileReader {
readAsDataURL = stub();
}

describe('<FileInput />', () => {
const sandbox = sinon.sandbox.create();
Expand Down
1 change: 0 additions & 1 deletion test/components/FilterList.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
Expand Down
3 changes: 1 addition & 2 deletions test/components/FormChoice.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { shallow } from 'enzyme';

import { Input, Label, FormGroup } from 'reactstrap';
import FormChoice from '../../src/components/FormChoice';
import { FormChoice } from '../../src';

describe('<FormChoice />', () => {
describe('unknown type', () => {
Expand Down
7 changes: 1 addition & 6 deletions test/components/FormRow.spec.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { shallow } from 'enzyme';

import { Input, Label, Col, FormText, FormFeedback } from 'reactstrap';
import FormRow from '../../src/components/FormRow';
import StaticInput from '../../src/components/StaticInput';
import RadioInput from '../../src/components/RadioInput';
import CheckboxInput from '../../src/components/CheckboxInput';
import FileInput from '../../src/components/FileInput';
import { FormRow, StaticInput, RadioInput, CheckboxInput, FileInput } from '../../src';

describe('<FormRow />', () => {
describe('by default', () => {
Expand Down
1 change: 0 additions & 1 deletion test/components/HasManyFields.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
Expand Down
4 changes: 1 addition & 3 deletions test/components/HasManyFieldsAdd.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { shallow } from 'enzyme';

import { Button } from 'reactstrap';
import Icon from '../../src/components/Icon';
import HasManyFieldsAdd from '../../src/components/HasManyFieldsAdd';
import { Icon, HasManyFieldsAdd } from '../../src';

describe('<HasManyFieldsAdd />', () => {
const component = shallow(
Expand Down
4 changes: 1 addition & 3 deletions test/components/HasManyFieldsRow.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
import { shallow } from 'enzyme';

import { Button, Col } from 'reactstrap';
import Icon from '../../src/components/Icon';
import HasManyFieldsRow from '../../src/components/HasManyFieldsRow';
import { Icon, HasManyFieldsRow } from '../../src';

describe('<HasManyFieldsRow />', () => {
const onDelete = sinon.spy();
Expand Down
4 changes: 1 addition & 3 deletions test/components/HelpBubble.spec.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
import { Icon } from '../../src';
import { Popover, PopoverTitle, PopoverContent } from 'reactstrap';
import { Icon, HelpBubble } from '../../src';

import HelpBubble from '../../src/components/HelpBubble';

describe('<HelpBubble />', () => {
it('should have a question mark', () => {
Expand Down
1 change: 0 additions & 1 deletion test/components/InfoBox.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
Expand Down
1 change: 0 additions & 1 deletion test/components/LabelBadge.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
Expand Down
3 changes: 0 additions & 3 deletions test/components/Modal.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */

import 'jsdom-global/register';
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
Expand Down
1 change: 0 additions & 1 deletion test/components/Note.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { Note } from '../../src';
Expand Down
1 change: 0 additions & 1 deletion test/components/Notes.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import { Notes } from '../../src';
Expand Down
1 change: 0 additions & 1 deletion test/components/Paginator.spec.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
Expand Down
3 changes: 1 addition & 2 deletions test/components/PatternInput.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-env mocha */
import React from 'react';
import assert from 'assert';
import sinon from 'sinon';
import { mount } from 'enzyme';

import PatternInput from '../../src/components/PatternInput';
import { PatternInput } from '../../src';

describe('<PatternInput />', () => {
it('restrictInput should only prevent onChange for invalid input', () => {
Expand Down
3 changes: 0 additions & 3 deletions test/components/Progress.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
/* eslint-env mocha */

import 'jsdom-global/register';
import React from 'react';
import assert from 'assert';
import { mount } from 'enzyme';
Expand Down
Loading

0 comments on commit 4020d6b

Please sign in to comment.