Skip to content

Commit 15f0770

Browse files
authored
Merge pull request #13 from diwao/use_es2015
sampleコードをes2015に
2 parents 5ffa6af + 846e002 commit 15f0770

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
### 動作環境
88

9-
* Node.js : 6以上
9+
* Node.js : 8以上
1010

1111
### セットアップ
1212

@@ -49,7 +49,7 @@ $ npm test
4949

5050
2 passing (9ms)
5151

52-
$
52+
$
5353
```
5454

5555
### コマンド

lib/sample.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1-
function Sample() {
1+
class Sample {
2+
constructor() {
23
this.status = true;
3-
}
4+
}
45

5-
Sample.prototype.say = function () {
6+
say() {
67
return 'Hello TDDBC!';
7-
};
8+
}
9+
}
810

911
module.exports = Sample;

test/SampleTest.js

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
1-
var assert = require('assert');
1+
const assert = require('assert');
22

3-
var Sample = require('../lib/sample');
3+
const Sample = require('../lib/sample');
44

5-
describe('Sample', function () {
6-
var sut;
5+
describe('Sample', () => {
6+
let sut;
77

8-
beforeEach(function () {
9-
sut = new Sample();
10-
});
8+
beforeEach(() => {
9+
sut = new Sample();
10+
});
1111

12-
describe('.status', function () {
13-
it('は、trueであるべき', function () {
14-
assert.ok(sut.status === true);
15-
});
12+
describe('.status', () => {
13+
it('は、trueであるべき', () => {
14+
assert.ok(sut.status === true);
1615
});
16+
});
1717

18-
describe('#say()', function () {
19-
it('は、"Hello TDDBC!"が返ってくるべき', function () {
20-
assert(sut.say() === 'Hello TDDBC!');
21-
});
18+
describe('#say()', () => {
19+
it('は、"Hello TDDBC!"が返ってくるべき', () => {
20+
assert(sut.say() === 'Hello TDDBC!');
2221
});
22+
});
2323
});

0 commit comments

Comments
 (0)