From d5b767c3747b9e7f9afcbcecffb662843ca2a346 Mon Sep 17 00:00:00 2001 From: Yamagishi Kazutoshi Date: Mon, 16 Oct 2017 16:33:08 +0900 Subject: Replace JavaScript Testing Framework from Mocha to Jest (#5412) --- spec/javascript/.eslintrc.yml | 3 - spec/javascript/components/avatar.test.js | 44 -------- spec/javascript/components/avatar_overlay.test.js | 36 ------- spec/javascript/components/button.test.js | 72 ------------- spec/javascript/components/display_name.test.js | 18 ---- spec/javascript/components/emoji_index.test.js | 111 --------------------- spec/javascript/components/emojify.test.js | 61 ----------- .../features/ui/components/column.test.js | 30 ------ spec/javascript/setup.js | 15 --- 9 files changed, 390 deletions(-) delete mode 100644 spec/javascript/.eslintrc.yml delete mode 100644 spec/javascript/components/avatar.test.js delete mode 100644 spec/javascript/components/avatar_overlay.test.js delete mode 100644 spec/javascript/components/button.test.js delete mode 100644 spec/javascript/components/display_name.test.js delete mode 100644 spec/javascript/components/emoji_index.test.js delete mode 100644 spec/javascript/components/emojify.test.js delete mode 100644 spec/javascript/components/features/ui/components/column.test.js delete mode 100644 spec/javascript/setup.js (limited to 'spec') diff --git a/spec/javascript/.eslintrc.yml b/spec/javascript/.eslintrc.yml deleted file mode 100644 index 6db2a46c5..000000000 --- a/spec/javascript/.eslintrc.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -env: - mocha: true diff --git a/spec/javascript/components/avatar.test.js b/spec/javascript/components/avatar.test.js deleted file mode 100644 index 34949f2b5..000000000 --- a/spec/javascript/components/avatar.test.js +++ /dev/null @@ -1,44 +0,0 @@ -import React from 'react'; -import Avatar from '../../../app/javascript/mastodon/components/avatar'; - -import { expect } from 'chai'; -import { render } from 'enzyme'; -import { fromJS } from 'immutable'; - -describe('', () => { - const account = fromJS({ - username: 'alice', - acct: 'alice', - display_name: 'Alice', - avatar: '/animated/alice.gif', - avatar_static: '/static/alice.jpg', - }); - - const size = 100; - const animated = render(); - const still = render(); - - // Autoplay - xit('renders a div element with the given src as background', () => { - expect(animated.find('div')).to.have.style('background-image', `url(${account.get('avatar')})`); - }); - - xit('renders a div element of the given size', () => { - ['width', 'height'].map((attr) => { - expect(animated.find('div')).to.have.style(attr, `${size}px`); - }); - }); - - // Still - xit('renders a div element with the given static src as background if not autoplay', () => { - expect(still.find('div')).to.have.style('background-image', `url(${account.get('avatar_static')})`); - }); - - xit('renders a div element of the given size if not autoplay', () => { - ['width', 'height'].map((attr) => { - expect(still.find('div')).to.have.style(attr, `${size}px`); - }); - }); - - // TODO add autoplay test if possible -}); diff --git a/spec/javascript/components/avatar_overlay.test.js b/spec/javascript/components/avatar_overlay.test.js deleted file mode 100644 index fe1d3a012..000000000 --- a/spec/javascript/components/avatar_overlay.test.js +++ /dev/null @@ -1,36 +0,0 @@ -import React from 'react'; -import AvatarOverlay from '../../../app/javascript/mastodon/components/avatar_overlay'; - -import { expect } from 'chai'; -import { render } from 'enzyme'; -import { fromJS } from 'immutable'; - -describe('', () => { - const account = fromJS({ - username: 'alice', - acct: 'alice', - display_name: 'Alice', - avatar: '/animated/alice.gif', - avatar_static: '/static/alice.jpg', - }); - - const friend = fromJS({ - username: 'eve', - acct: 'eve@blackhat.lair', - display_name: 'Evelyn', - avatar: '/animated/eve.gif', - avatar_static: '/static/eve.jpg', - }); - - const overlay = render(); - - xit('renders account static src as base of overlay avatar', () => { - expect(overlay.find('.account__avatar-overlay-base')) - .to.have.style('background-image', `url(${account.get('avatar_static')})`); - }); - - xit('renders friend static src as overlay of overlay avatar', () => { - expect(overlay.find('.account__avatar-overlay-overlay')) - .to.have.style('background-image', `url(${friend.get('avatar_static')})`); - }); -}); diff --git a/spec/javascript/components/button.test.js b/spec/javascript/components/button.test.js deleted file mode 100644 index d2cd0b4e7..000000000 --- a/spec/javascript/components/button.test.js +++ /dev/null @@ -1,72 +0,0 @@ -import React from 'react'; -import Button from '../../../app/javascript/mastodon/components/button'; - -import { expect } from 'chai'; -import { shallow } from 'enzyme'; -import sinon from 'sinon'; - -describe('); - expect(wrapper.find('button')).to.contain(children); - }); - - xit('renders the props.text instead of children', () => { - const text = 'foo'; - const children =

children

; - const wrapper = shallow(); - expect(wrapper.find('button')).to.have.text(text); - expect(wrapper.find('button')).to.not.contain(children); - }); - - xit('renders style="display: block; width: 100%;" if props.block given', () => { - const wrapper = shallow(