Fakultas Ilmu Komputer UI

Commit 0f1d4a0c authored by M. Reza Qorib's avatar M. Reza Qorib
Browse files

[#140382397] #10 Create test for login

parent 736580be
......@@ -611,7 +611,7 @@
/* 2 */
/***/ function(module, exports, __webpack_require__) {
 
'use strict';var cov_14uo3ys0wo=function(){var path='A:\\Kuliah\\Semester 6\\PPL\\kape\\assets\\js\\__test__\\FormLogin-test.jsx',hash='4d1bbba3a66233eb9ed9b8d9baf6ca6f52aece78',global=new Function('return this')(),gcv='__coverage__',coverageData={path:'A:\\Kuliah\\Semester 6\\PPL\\kape\\assets\\js\\__test__\\FormLogin-test.jsx',statementMap:{'0':{start:{line:3,column:13},end:{line:3,column:29}},'1':{start:{line:5,column:14},end:{line:5,column:44}},'2':{start:{line:7,column:14},end:{line:7,column:31}},'3':{start:{line:9,column:15},end:{line:9,column:46}},'4':{start:{line:11,column:16},end:{line:11,column:36}},'5':{start:{line:13,column:17},end:{line:13,column:50}},'6':{start:{line:15,column:28},end:{line:15,column:62}},'7':{start:{line:17,column:29},end:{line:17,column:74}},'8':{start:{line:19,column:17},end:{line:19,column:51}},'9':{start:{line:21,column:18},end:{line:21,column:52}},'10':{start:{line:23,column:39},end:{line:23,column:93}},'11':{start:{line:25,column:0},end:{line:51,column:3}},'12':{start:{line:26,column:2},end:{line:35,column:5}},'13':{start:{line:27,column:20},end:{line:27,column:134}},'14':{start:{line:28,column:4},end:{line:28,column:47}},'15':{start:{line:30,column:18},end:{line:30,column:106}},'16':{start:{line:31,column:4},end:{line:31,column:45}},'17':{start:{line:33,column:15},end:{line:33,column:96}},'18':{start:{line:34,column:4},end:{line:34,column:42}},'19':{start:{line:37,column:2},end:{line:50,column:5}},'20':{start:{line:38,column:20},end:{line:38,column:127}},'21':{start:{line:40,column:20},end:{line:40,column:72}},'22':{start:{line:41,column:16},end:{line:41,column:23}},'23':{start:{line:42,column:23},end:{line:42,column:78}},'24':{start:{line:43,column:19},end:{line:43,column:26}},'25':{start:{line:45,column:4},end:{line:45,column:28}},'26':{start:{line:46,column:4},end:{line:46,column:34}},'27':{start:{line:48,column:4},end:{line:48,column:62}}},fnMap:{'0':{name:'_interopRequireDefault',decl:{start:{line:23,column:9},end:{line:23,column:31}},loc:{start:{line:23,column:37},end:{line:23,column:95}}},'1':{name:'(anonymous_1)',decl:{start:{line:25,column:22},end:{line:25,column:23}},loc:{start:{line:25,column:34},end:{line:51,column:1}}},'2':{name:'(anonymous_2)',decl:{start:{line:26,column:32},end:{line:26,column:33}},loc:{start:{line:26,column:44},end:{line:35,column:3}}},'3':{name:'(anonymous_3)',decl:{start:{line:37,column:37},end:{line:37,column:38}},loc:{start:{line:37,column:49},end:{line:50,column:3}}}},branchMap:{'0':{loc:{start:{line:23,column:46},end:{line:23,column:92}},type:'cond-expr',locations:[{start:{line:23,column:70},end:{line:23,column:73}},{start:{line:23,column:76},end:{line:23,column:92}}]},'1':{loc:{start:{line:23,column:46},end:{line:23,column:67}},type:'binary-expr',locations:[{start:{line:23,column:46},end:{line:23,column:49}},{start:{line:23,column:53},end:{line:23,column:67}}]}},s:{'0':0,'1':0,'2':0,'3':0,'4':0,'5':0,'6':0,'7':0,'8':0,'9':0,'10':0,'11':0,'12':0,'13':0,'14':0,'15':0,'16':0,'17':0,'18':0,'19':0,'20':0,'21':0,'22':0,'23':0,'24':0,'25':0,'26':0,'27':0},f:{'0':0,'1':0,'2':0,'3':0},b:{'0':[0,0],'1':[0,0]},inputSourceMap:null,_coverageSchema:'332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'},coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}coverageData.hash=hash;return coverage[path]=coverageData;}();var _react=(++cov_14uo3ys0wo.s[0],__webpack_require__(3));var _react2=(++cov_14uo3ys0wo.s[1],_interopRequireDefault(_react));var _expect=(++cov_14uo3ys0wo.s[2],__webpack_require__(34));var _expect2=(++cov_14uo3ys0wo.s[3],_interopRequireDefault(_expect));var _reactDom=(++cov_14uo3ys0wo.s[4],__webpack_require__(65));var _reactDom2=(++cov_14uo3ys0wo.s[5],_interopRequireDefault(_reactDom));var _reactAddonsTestUtils=(++cov_14uo3ys0wo.s[6],__webpack_require__(211));var _reactAddonsTestUtils2=(++cov_14uo3ys0wo.s[7],_interopRequireDefault(_reactAddonsTestUtils));var _FormLogin=(++cov_14uo3ys0wo.s[8],__webpack_require__(215));var _FormLogin2=(++cov_14uo3ys0wo.s[9],_interopRequireDefault(_FormLogin));function _interopRequireDefault(obj){++cov_14uo3ys0wo.f[0];++cov_14uo3ys0wo.s[10];return(++cov_14uo3ys0wo.b[1][0],obj)&&(++cov_14uo3ys0wo.b[1][1],obj.__esModule)?(++cov_14uo3ys0wo.b[0][0],obj):(++cov_14uo3ys0wo.b[0][1],{default:obj});}++cov_14uo3ys0wo.s[11];describe('FormLogin',function(){++cov_14uo3ys0wo.f[1];++cov_14uo3ys0wo.s[12];it('renders without problem',function(){++cov_14uo3ys0wo.f[2];var formLogin=(++cov_14uo3ys0wo.s[13],_reactAddonsTestUtils2.default.renderIntoDocument(_react2.default.createElement(_FormLogin2.default,{url:''})));++cov_14uo3ys0wo.s[14];(0,_expect2.default)(formLogin).toExist();var formDiv=(++cov_14uo3ys0wo.s[15],_reactAddonsTestUtils2.default.findRenderedDOMComponentWithClass(formLogin,'formLogin'));++cov_14uo3ys0wo.s[16];(0,_expect2.default)(formDiv).toExist();var form=(++cov_14uo3ys0wo.s[17],_reactAddonsTestUtils2.default.findRenderedDOMComponentWithTag(formLogin,'form'));++cov_14uo3ys0wo.s[18];(0,_expect2.default)(form).toExist();});++cov_14uo3ys0wo.s[19];it('handle input without problem',function(){++cov_14uo3ys0wo.f[3];var formLogin=(++cov_14uo3ys0wo.s[20],_reactAddonsTestUtils2.default.renderIntoDocument(_react2.default.createElement(_FormLogin2.default,null)));var emailNode=(++cov_14uo3ys0wo.s[21],_reactDom2.default.findDOMNode(formLogin.refs.email));var email=(++cov_14uo3ys0wo.s[22],'jojon');var passwordNode=(++cov_14uo3ys0wo.s[23],_reactDom2.default.findDOMNode(formLogin.refs.password));var password=(++cov_14uo3ys0wo.s[24],'jojon');++cov_14uo3ys0wo.s[25];emailNode.value=email;++cov_14uo3ys0wo.s[26];passwordNode.value=password;++cov_14uo3ys0wo.s[27];_reactAddonsTestUtils2.default.Simulate.change(emailNode);// expect(userNode.textContent).toEqual
'use strict';var cov_14uo3ys0wo=function(){var path='A:\\Kuliah\\Semester 6\\PPL\\kape\\assets\\js\\__test__\\LoginForm-test.jsx',hash='4d1bbba3a66233eb9ed9b8d9baf6ca6f52aece78',global=new Function('return this')(),gcv='__coverage__',coverageData={path:'A:\\Kuliah\\Semester 6\\PPL\\kape\\assets\\js\\__test__\\LoginForm-test.jsx',statementMap:{'0':{start:{line:3,column:13},end:{line:3,column:29}},'1':{start:{line:5,column:14},end:{line:5,column:44}},'2':{start:{line:7,column:14},end:{line:7,column:31}},'3':{start:{line:9,column:15},end:{line:9,column:46}},'4':{start:{line:11,column:16},end:{line:11,column:36}},'5':{start:{line:13,column:17},end:{line:13,column:50}},'6':{start:{line:15,column:28},end:{line:15,column:62}},'7':{start:{line:17,column:29},end:{line:17,column:74}},'8':{start:{line:19,column:17},end:{line:19,column:51}},'9':{start:{line:21,column:18},end:{line:21,column:52}},'10':{start:{line:23,column:39},end:{line:23,column:93}},'11':{start:{line:25,column:0},end:{line:51,column:3}},'12':{start:{line:26,column:2},end:{line:35,column:5}},'13':{start:{line:27,column:20},end:{line:27,column:134}},'14':{start:{line:28,column:4},end:{line:28,column:47}},'15':{start:{line:30,column:18},end:{line:30,column:106}},'16':{start:{line:31,column:4},end:{line:31,column:45}},'17':{start:{line:33,column:15},end:{line:33,column:96}},'18':{start:{line:34,column:4},end:{line:34,column:42}},'19':{start:{line:37,column:2},end:{line:50,column:5}},'20':{start:{line:38,column:20},end:{line:38,column:127}},'21':{start:{line:40,column:20},end:{line:40,column:72}},'22':{start:{line:41,column:16},end:{line:41,column:23}},'23':{start:{line:42,column:23},end:{line:42,column:78}},'24':{start:{line:43,column:19},end:{line:43,column:26}},'25':{start:{line:45,column:4},end:{line:45,column:28}},'26':{start:{line:46,column:4},end:{line:46,column:34}},'27':{start:{line:48,column:4},end:{line:48,column:62}}},fnMap:{'0':{name:'_interopRequireDefault',decl:{start:{line:23,column:9},end:{line:23,column:31}},loc:{start:{line:23,column:37},end:{line:23,column:95}}},'1':{name:'(anonymous_1)',decl:{start:{line:25,column:22},end:{line:25,column:23}},loc:{start:{line:25,column:34},end:{line:51,column:1}}},'2':{name:'(anonymous_2)',decl:{start:{line:26,column:32},end:{line:26,column:33}},loc:{start:{line:26,column:44},end:{line:35,column:3}}},'3':{name:'(anonymous_3)',decl:{start:{line:37,column:37},end:{line:37,column:38}},loc:{start:{line:37,column:49},end:{line:50,column:3}}}},branchMap:{'0':{loc:{start:{line:23,column:46},end:{line:23,column:92}},type:'cond-expr',locations:[{start:{line:23,column:70},end:{line:23,column:73}},{start:{line:23,column:76},end:{line:23,column:92}}]},'1':{loc:{start:{line:23,column:46},end:{line:23,column:67}},type:'binary-expr',locations:[{start:{line:23,column:46},end:{line:23,column:49}},{start:{line:23,column:53},end:{line:23,column:67}}]}},s:{'0':0,'1':0,'2':0,'3':0,'4':0,'5':0,'6':0,'7':0,'8':0,'9':0,'10':0,'11':0,'12':0,'13':0,'14':0,'15':0,'16':0,'17':0,'18':0,'19':0,'20':0,'21':0,'22':0,'23':0,'24':0,'25':0,'26':0,'27':0},f:{'0':0,'1':0,'2':0,'3':0},b:{'0':[0,0],'1':[0,0]},inputSourceMap:null,_coverageSchema:'332fd63041d2c1bcb487cc26dd0d5f7d97098a6c'},coverage=global[gcv]||(global[gcv]={});if(coverage[path]&&coverage[path].hash===hash){return coverage[path];}coverageData.hash=hash;return coverage[path]=coverageData;}();var _react=(++cov_14uo3ys0wo.s[0],__webpack_require__(3));var _react2=(++cov_14uo3ys0wo.s[1],_interopRequireDefault(_react));var _expect=(++cov_14uo3ys0wo.s[2],__webpack_require__(34));var _expect2=(++cov_14uo3ys0wo.s[3],_interopRequireDefault(_expect));var _reactDom=(++cov_14uo3ys0wo.s[4],__webpack_require__(65));var _reactDom2=(++cov_14uo3ys0wo.s[5],_interopRequireDefault(_reactDom));var _reactAddonsTestUtils=(++cov_14uo3ys0wo.s[6],__webpack_require__(211));var _reactAddonsTestUtils2=(++cov_14uo3ys0wo.s[7],_interopRequireDefault(_reactAddonsTestUtils));var _FormLogin=(++cov_14uo3ys0wo.s[8],__webpack_require__(215));var _FormLogin2=(++cov_14uo3ys0wo.s[9],_interopRequireDefault(_FormLogin));function _interopRequireDefault(obj){++cov_14uo3ys0wo.f[0];++cov_14uo3ys0wo.s[10];return(++cov_14uo3ys0wo.b[1][0],obj)&&(++cov_14uo3ys0wo.b[1][1],obj.__esModule)?(++cov_14uo3ys0wo.b[0][0],obj):(++cov_14uo3ys0wo.b[0][1],{default:obj});}++cov_14uo3ys0wo.s[11];describe('FormLogin',function(){++cov_14uo3ys0wo.f[1];++cov_14uo3ys0wo.s[12];it('renders without problem',function(){++cov_14uo3ys0wo.f[2];var formLogin=(++cov_14uo3ys0wo.s[13],_reactAddonsTestUtils2.default.renderIntoDocument(_react2.default.createElement(_FormLogin2.default,{url:''})));++cov_14uo3ys0wo.s[14];(0,_expect2.default)(formLogin).toExist();var formDiv=(++cov_14uo3ys0wo.s[15],_reactAddonsTestUtils2.default.findRenderedDOMComponentWithClass(formLogin,'formLogin'));++cov_14uo3ys0wo.s[16];(0,_expect2.default)(formDiv).toExist();var form=(++cov_14uo3ys0wo.s[17],_reactAddonsTestUtils2.default.findRenderedDOMComponentWithTag(formLogin,'form'));++cov_14uo3ys0wo.s[18];(0,_expect2.default)(form).toExist();});++cov_14uo3ys0wo.s[19];it('handle input without problem',function(){++cov_14uo3ys0wo.f[3];var formLogin=(++cov_14uo3ys0wo.s[20],_reactAddonsTestUtils2.default.renderIntoDocument(_react2.default.createElement(_FormLogin2.default,null)));var emailNode=(++cov_14uo3ys0wo.s[21],_reactDom2.default.findDOMNode(formLogin.refs.email));var email=(++cov_14uo3ys0wo.s[22],'jojon');var passwordNode=(++cov_14uo3ys0wo.s[23],_reactDom2.default.findDOMNode(formLogin.refs.password));var password=(++cov_14uo3ys0wo.s[24],'jojon');++cov_14uo3ys0wo.s[25];emailNode.value=email;++cov_14uo3ys0wo.s[26];passwordNode.value=password;++cov_14uo3ys0wo.s[27];_reactAddonsTestUtils2.default.Simulate.change(emailNode);// expect(userNode.textContent).toEqual
});});/**
* Created by M. Reza Qorib on 3/23/2017.
*/
......@@ -5,18 +5,18 @@ import React from 'react';
// import expect from 'expect';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-addons-test-utils';
import FormLogin from '../components/FormLogin';
import LoginForm from '../components/LoginForm';
import 'babel-polyfill';
describe('FormLogin', () => {
describe('LoginForm', () => {
it('created without problem', () => {
const formLogin = new FormLogin({ url: 'tes' });
expect(formLogin).to.be.an.instanceof(FormLogin);
expect(formLogin).to.be.an.instanceof(LoginForm);
});
it('renders without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<FormLogin url="" />);
<LoginForm url="" />);
expect(formLogin).to.exist;
const formDiv = ReactTestUtils.findRenderedDOMComponentWithClass(
......@@ -30,7 +30,7 @@ describe('FormLogin', () => {
it('handle email input without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<FormLogin url="" />);
<LoginForm url="" />);
expect(formLogin.state.email).to.equal('');
const emailNode = ReactTestUtils.scryRenderedDOMComponentsWithTag(formLogin, 'Input')[0];
// const emailNode = ReactDOM.findDOMNode(formLogin.refs.email);
......@@ -44,7 +44,7 @@ describe('FormLogin', () => {
it('submit form without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<FormLogin url="" />);
<LoginForm url="" />);
const passwordNode = ReactTestUtils.scryRenderedDOMComponentsWithTag(formLogin, 'Input')[1];
// const passwordNode = ReactDOM.findDOMNode(formLogin.refs.password);
......@@ -58,7 +58,7 @@ describe('FormLogin', () => {
it('handle password input without problem', () => {
const formLogin = ReactTestUtils.renderIntoDocument(
<FormLogin url="" />);
<LoginForm url="" />);
const submitButton = ReactDOM.findDOMNode(formLogin.refs.submit);
ReactTestUtils.Simulate.click(submitButton);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment