随笔分类 - Unit Testing
摘要:Let's learn how to unit test your JavaScript with Jest, a JavaScript unit testing framework from Facebook. We'll install and optimize Jest for this pr
阅读全文
摘要:Child: parent:
阅读全文
摘要:Install Karam: npm install -g karma npm install -g karma-cli Init Karam: karma init First test: 1. Add test file to the karma.conf.js: // list of file
阅读全文
posted @ 2016-03-06 18:14
Zhentiw
摘要:describe( 'Forgot Password: with username', ()=> { let dirElementInput; beforeEach( ()=> { // Find the input control: dirElementInput = directiveElem.
阅读全文
posted @ 2016-02-04 20:26
Zhentiw
摘要:Sometimes we want to test our Redux reducers to make sure they work as expected. In this lesson we will walk through setting up some Redux reducer tes...
阅读全文
posted @ 2016-01-12 03:21
Zhentiw
摘要:When using Redux, we can test that our application state changes are working by testing that dispatching actions to the store creates our expected out...
阅读全文
posted @ 2016-01-11 17:06
Zhentiw
摘要:When testing React components, we often want to make sure the rendered output of the component matches what we expect. With the React Shallow Renderer...
阅读全文
posted @ 2016-01-07 16:53
Zhentiw
摘要:Setting up a shallow renderer for each test can be redundant, especially when trying to write similar tests that have slight tweaks. In this lesson, w...
阅读全文
posted @ 2016-01-07 15:12
Zhentiw
摘要:Often our components have output that shows differently depending on the props it is given; in this lesson, we go over how to compare theclassNameprop...
阅读全文
posted @ 2016-01-07 03:52
Zhentiw
摘要:The React Shallow Renderer test utility lets us inspect the output of a component one level deep. In this lesson, we will examine the rendered output ...
阅读全文
posted @ 2016-01-07 03:37
Zhentiw
摘要:When you render a component with the Shallow Renderer, you have access to the underlying object. We can write lots of useful tests to check that our c...
阅读全文
posted @ 2016-01-05 02:26
Zhentiw
摘要:When writing React component tests, it can be hard to decipher the error diffs of broken tests, since they are just the final objects that React uses ...
阅读全文
posted @ 2016-01-05 01:54
Zhentiw
摘要:In this lesson, we walk through how to use one of React's Test Utilities (from thereact-addons-test-utilspackage) called "Shallow Rendering". This let...
阅读全文
posted @ 2016-01-05 01:23
Zhentiw
摘要:To write tests for our React code, we need to first install some libraries for running tests and writing assertions. In this lesson we walk through se...
阅读全文
posted @ 2016-01-04 03:59
Zhentiw
摘要:Using mocha: "devDependencies": { "should": "^5.2.0", "supertest": "^0.15.0" } process.env.A127_ENV = 'test'; var should = require('should'); var requ
阅读全文
posted @ 2015-12-18 15:53
Zhentiw
摘要:// backend test beforeEach(inject(function (_$compile_, _$httpBackend_, _$rootScope_, _$state_, _AnnouncementsService_, _CONFIG_) { ...
阅读全文
posted @ 2015-12-11 03:29
Zhentiw
摘要:{{vm.userInfo.number}} - {{vm.userInfo.name}}'use strict';class CardTitleInformCtrl { constructor() { }}function CardTitleInformDirective() ...
阅读全文
posted @ 2015-10-20 03:02
Zhentiw
摘要:http://social.technet.microsoft.com/wiki/contents/articles/32300.angularjs-unit-testing-using-karma-part-1.aspxTesting ControllerTesting $httpbackendT...
阅读全文
posted @ 2015-10-12 01:08
Zhentiw
摘要:import React from 'react/addons';import Note from '../app/components/notes/Notes';var TestUtils = React.addons.TestUtils;describe('Note', () => { v...
阅读全文
posted @ 2015-08-10 21:41
Zhentiw
摘要:FACTORIESConvert thezombiesfixture to a Factory GirlFactorycalled:zombie.test/fixture/zombies.ymlzombie: name: 'Sally' graveyard: 'Valley Dim'Answer...
阅读全文
posted @ 2014-11-12 22:15
Zhentiw