jestjs

    0熱度

    1回答

    我使用jest框架來測試。 我存儲數據以在對象中創建摘要,將該對象傳遞給創建摘要的服務,並使用其他數據返回摘要。我從摘要中選擇所需的字段,並與包含數據的對象進行比較以創建摘要並出現錯誤,該如何解決? const summaryData = { userHash: 'some-hash', hash: 'hash', title: 'Sumary title',

    0熱度

    1回答

    我有這樣的代碼:在這個例子中 render() { ... const { exampleMethod, } = this.props; const { getPath } = this.context; const exampletData = exampleMethod(getPath()); ... } 我如何

    1熱度

    2回答

    我試圖運行這個jestJS單元測試,但我確實得到了TypeError: Promise resolver undefined is not a function。我究竟做錯了什麼? it('_onSubmit() should throw error if data is missing', (done) => { const createUserMutation =() => new

    0熱度

    1回答

    我寫這些文字轉換與\ n換行符到HTML段落組成 Text.js const Text = props => (( <div> { props.paragraph.split('\n').map((line, index) => { if (line.length === 0) return; return <p key={index}>{ line }<

    2熱度

    1回答

    我不明白如何偵測一個模塊內部的方法/函數是否被觸發。 這是我的例子: db.js module.exports.saveUser = (user) => { console.log('Saving the user', user); }; app.js let db = require('./db'); module.exports.handleSignup = (email,

    0熱度

    1回答

    我有一個「notifications.js」模塊,看起來有點像這樣: import { Notifications, Permissions } from 'expo' export function setLocalNotification(storage = AsyncStorage) { return storage .getItem(NOTIFICATION_KEY

    0熱度

    1回答

    我寫這我想與特拉維斯CI使用的NPM模塊。我的測試是用Jest編寫的,當我從本地命令行運行時,所有測試都通過了。 然而,我將它們上傳到github上(https://github.com/jaysaurus/echo-handler)時,特拉維斯運行我的代碼,並吐出了以下異常: 0.69s$ npm test > [email protected] test /home/travis/buil

    3熱度

    1回答

    我使用Jest和酵素來測試一個表單組件,並且我很難讓點擊模擬工作。供參考:Button是一個風格rebass按鈕,並且存在於這樣的形式: <Button type="reset" disabled={pristine || submitting} onClick={() => onClose(dirty)} > 這裏是一個的測試失敗: it('should ha

    0熱度

    1回答

    如果屬性errorMessage不是null,我有一個呈現按鈕的組件。 class App extends Component { static propTypes = { // Injected by React Redux errorMessage: PropTypes.string, resetErrorMessage: PropTypes.func.

    -1熱度

    1回答

    我有很多測試,在升級到React 16之前正常工作,以及各自升級到enzime和jest。我跟着the instructions,在我的package.json "jest": { "globals": { "rootLevel": "/portal" }, "moduleNameMapper": { "components": "<rootDir