Skip to content

Commit 113a05f

Browse files
author
pasit.r
committed
standard format
1 parent d3111eb commit 113a05f

File tree

2 files changed

+12
-21
lines changed

2 files changed

+12
-21
lines changed

test/reverse-words.spec.js

+2-4
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,12 @@ import * as io from '../src/utils/io.js'
44
import reverseWords, {reverse, reverseLine, formatOutput} from '../src/reverse-words/reverse-words.js'
55

66
describe('reverse words', () => {
7-
8-
beforeEach(function(){
7+
beforeEach(function () {
98
let eol = td.replace(io, 'endOfLine')
109
td.when(eol()).thenReturn('\n')
1110
})
1211

13-
afterEach(function(){
12+
afterEach(function () {
1413
td.reset()
1514
})
1615

@@ -64,5 +63,4 @@ describe('reverse words', () => {
6463
td.verify(writeFile(`Case #1: test a is this\nCase #2: foobar\nCase #3: base your all`))
6564
})
6665
})
67-
6866
})

test/spelling.spec.js

+10-17
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,7 @@ import * as io from '../src/utils/io.js'
44
import t9, {convert, convertLine, convertMulti} from '../src/spelling/t9.js'
55

66
describe('t9-spelling', () => {
7-
87
describe('single line', () => {
9-
108
it('spell "hi"', () => {
119
expect(convertLine('hi')).to.eq('44 444')
1210
})
@@ -30,8 +28,7 @@ describe('t9-spelling', () => {
3028
})
3129

3230
describe('convert multiline', () => {
33-
34-
before(function() {
31+
before(function () {
3532
const input = `4
3633
hi
3734
yes
@@ -41,54 +38,50 @@ hello world`
4138
this.result = convertMulti(input)
4239
})
4340

44-
it('skip first and empty line', function() {
41+
it('skip first and empty line', function () {
4542
expect(this.result).to.have.length(4)
4643
})
4744

48-
it('convert each line', function() {
45+
it('convert each line', function () {
4946
expect(this.result[0]).to.eq('44 444')
5047
})
5148

52-
it('convert last line', function() {
49+
it('convert last line', function () {
5350
expect(this.result[3]).to.eq('4433555 555666096667775553')
5451
})
5552
})
5653

5754
describe('convert', () => {
58-
59-
before(function() {
55+
before(function () {
6056
this.result = convert(`2\n hi\nyes`)
6157
})
6258

63-
it('returns single string', function() {
59+
it('returns single string', function () {
6460
expect(this.result).to.be.a('String')
6561
})
6662

67-
it('format each line', function() {
63+
it('format each line', function () {
6864
expect(this.result).to.eq('Case #1: 044 444\nCase #2: 999337777')
6965
})
70-
7166
})
7267

7368
describe('default', () => {
74-
75-
before(function() {
69+
before(function () {
7670
this.writeFile = td.replace(io, 'writeFile')
7771
const readAsString = td.replace(io, 'readAsString')
7872
const input = `2\nfoo bar\nboo`
7973
td.when(readAsString('input.file')).thenReturn(Promise.resolve(input))
8074
})
8175

82-
afterEach(function() {
76+
afterEach(function () {
8377
td.reset()
8478
})
8579

86-
it('calls readAsString', function(){
80+
it('calls readAsString', function () {
8781
return t9('input.file').then(() => {
8882
// console.log(td.explain(this.writeFile).description)
8983
td.verify(this.writeFile('Case #1: 333666 6660 022 2777\nCase #2: 22666 666'))
9084
})
9185
})
92-
9386
})
9487
})

0 commit comments

Comments
 (0)