Fakultas Ilmu Komputer UI

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

[#140382397] #4 mencoba bikin testing untuk server.jsx

parent 39170b0f
import React from 'react';
import ReactDOM from 'react-dom';
import ReactTestUtils from 'react-addons-test-utils' // ES6
import expect from 'expect';
import Root from '../root';
describe('root', function () {
it('renders without problems', function () {
let root = ReactTestUtils.renderIntoDocument(<Root/>);
expect(root).toExist();
});
it('changes without problems', function () {
let root = ReactTestUtils.renderIntoDocument(<Root/>);
const inputNode = ReactDOM.findDOMNode(root.refs.input);
const newValue = 'some text';
inputNode.value = newValue;
ReactTestUtils.Simulate.change(inputNode);
const nameNode = ReactDOM.findDOMNode(root.refs.name);
expect(nameNode.textContent).toEqual(newValue);
import expect from 'expect'; //kebutuhan dasar
import Server from "../lib/server";
import Logger from "../lib/logger";
describe('server', function () {
it('check logged in or not', function () {
let logged = Server.isLoggedIn();
expect(logged).toEqual(null);
document.cookie = "sessionid=John Smith; expires=Thu, 18 Dec 2013 12:00:00 UTC; path=/";
Logger.log(document.cookie);
logged = Server.isLoggedIn();
expect(logged).toEqual("John Smith");
});
});
\ No newline at end of file
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