Cannot test with enzyme and jest
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 25/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 停滞
- 技術スタック
- javascript, react
調査の方向性
Issue に示されているパスにある ErrorDialog コンポーネントとそのテストから始め、インポートされた rc-dialog コンポーネントが Enzyme shallow によってどのようにレンダリングされるかを調べます。報告されたテキスト出力を再現し、テストまたはコンポーネントの動作のどちらが誤っているのかを判断します。テストで期待されるメッセージとコードの不在を確実に確認できるか、必要なプロジェクト変更によって issue が明確になれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Hi, I was trying to test the dialog component but it's not working.
Here is my component code
import Toast from '@/utils/Toast';
import PropTypes from 'prop-types';
import Dialog from 'rc-dialog';
import React from 'react';
import enhanceMessage from './enhanceMessage';
function ErrorDialog({ dismissError, error, breakoutFullText }) {
const { message, code, name } = error || {};
const enhancedMessage = enhanceMessage(message, code, breakoutFullText, name);
const styles = {
dialogContent: {
display: ' flex',
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
},
};
if (code === 53105) {
Toast.info(breakoutFullText);
return true;
}
return error !== null ? (
<Dialog
title="Error"
className="main-dialog"
style={{ height: 200, width: 400, top: '20%' }}
onClose={() => dismissError()}
visible={error !== null}
destroyOnClose
animation="zoom"
maskAnimation="fade"
footer={
<button type="button" className="btn button" key="close" onClick={dismissError}>
OK
</button>
}>
<div style={styles.dialogContent}>
<h3>{name === 'NotFoundError' ? 'No camera found' : enhancedMessage}</h3>
<div>
{code && code !== 53105 && (
<pre>
<code>
Error Code:
{code}
</code>
</pre>
)}
</div>
</div>
</Dialog>
) : null;
}
Here is my test code
import ErrorDialog from '@/components/TwilioVideoMeeting/ErrorDialog/ErrorDialog';
import { shallow } from 'enzyme';
import Dialog from 'rc-dialog';
import React from 'react';
describe('Testing the ErrorDialog component', () => {
const message = 'Fake Error message';
it('should display error message but not error code is the later does not exist', () => {
const error = { message };
const wrapper = shallow(<ErrorDialog dismissError={() => {}} error={error} />);
expect(wrapper.find(Dialog).text()).toContain(message);
expect(wrapper.find('code').exists()).toBe(false);
});
});
It throws following error
the ErrorDialog component › should display error message but not error code is the later does not exist
expect(received).toContain(expected) // indexOf
Expected substring: "Fake Error message"
Received string: "< />"
Any Help would be appreciated
- 主要言語
- TypeScript
- スター
- 454
- フォーク
- 208
- 平均マージ
- 1時間 9分
- マージ済み PR(30日)
- 1
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
react-component/dialog のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 38/100
react-component/dialog#467 · リアクション 1 件 ·
-
为什么dialog没有淡入淡出的动画呀オープン
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
react-component/dialog#450 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
react-component/dialog#429 · コメント 1 件 ·
-
有没有安卓版啊オープン
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
react-component/dialog#407 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 45/100
react-component/dialog#382 · コメント 3 件 ·
react-component/dialog の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
メンテナーはふだん 1 日以内に返信
-
Inbox: permission prompt (perm:) sessions appear as duplicate agents in the recipient picker and participants対応中かも @Djiit が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
backnotprop/plannotator#4517 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
MoonshotAI/kimi-code#6000 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
OpenSlides/openslides-client#6768 ·
メンテナーはふだん 1 日以内に返信
-
bug
難易度 1/5 1〜3時間 初心者へのやさしさ 90/100
modelcontextprotocol/modelcontextprotocol#3622 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信