Skip to content

Commit 3167d5e

Browse files
committed
update sample js tests
1 parent 2a48d09 commit 3167d5e

File tree

7 files changed

+65
-413
lines changed

7 files changed

+65
-413
lines changed

README.md

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# Minimal Hapi React Webpack Boilerplate
22

3-
Secondary ticket market for PassageX
4-
53
### Overview
64

75
* React (client) hot module reloading is configured with react-transform-hmr

__tests__/charge.js

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { pxtToWei } from '../src/utils/charge';
2+
3+
describe('pxtToWei', () => {
4+
test('integer', () => {
5+
const pxt = 1
6+
expect(pxtToWei(pxt)).toBe(1000000000000000000);
7+
});
8+
9+
test('string', () => {
10+
const pxt = "1"
11+
expect(pxtToWei(pxt)).toBe(1000000000000000000);
12+
});
13+
14+
test('decimal', () => {
15+
const pxt = 0.1
16+
expect(pxtToWei(pxt)).toBe(100000000000000000);
17+
});
18+
19+
test('long decimal', () => {
20+
const pxt = 0.1046689365421890789
21+
expect(pxtToWei(pxt)).toBe(104668936542189078);
22+
});
23+
});

__tests__/test.jsx

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import Test from '../src/pages/Test';
2+
import React from 'react';
3+
import { mount } from 'enzyme';
4+
5+
describe('Test page', () => {
6+
7+
test('Title', () => {
8+
const wrapper = mount(
9+
<Test title={"My Title"}/>
10+
);
11+
12+
const h1 = wrapper.find('h1')
13+
expect(h1.text()).toBe('My Title')
14+
});
15+
16+
})

__tests__/ticket.jsx

-90
This file was deleted.

src/pages/Test.jsx

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react';
2+
import PropTypes from 'prop-types';
3+
4+
const Test = props =>
5+
(
6+
<div>
7+
<section className="top-header">
8+
<h1>
9+
{props.title}
10+
</h1>
11+
</section>
12+
</div>
13+
);
14+
15+
Test.propTypes = {
16+
title: PropTypes.string.isRequired
17+
};
18+
19+
export default Test;

0 commit comments

Comments
 (0)