@@ -4,9 +4,7 @@ import * as io from '../src/utils/io.js'
4
4
import t9 , { convert , convertLine , convertMulti } from '../src/spelling/t9.js'
5
5
6
6
describe ( 't9-spelling' , ( ) => {
7
-
8
7
describe ( 'single line' , ( ) => {
9
-
10
8
it ( 'spell "hi"' , ( ) => {
11
9
expect ( convertLine ( 'hi' ) ) . to . eq ( '44 444' )
12
10
} )
@@ -30,8 +28,7 @@ describe('t9-spelling', () => {
30
28
} )
31
29
32
30
describe ( 'convert multiline' , ( ) => {
33
-
34
- before ( function ( ) {
31
+ before ( function ( ) {
35
32
const input = `4
36
33
hi
37
34
yes
@@ -41,54 +38,50 @@ hello world`
41
38
this . result = convertMulti ( input )
42
39
} )
43
40
44
- it ( 'skip first and empty line' , function ( ) {
41
+ it ( 'skip first and empty line' , function ( ) {
45
42
expect ( this . result ) . to . have . length ( 4 )
46
43
} )
47
44
48
- it ( 'convert each line' , function ( ) {
45
+ it ( 'convert each line' , function ( ) {
49
46
expect ( this . result [ 0 ] ) . to . eq ( '44 444' )
50
47
} )
51
48
52
- it ( 'convert last line' , function ( ) {
49
+ it ( 'convert last line' , function ( ) {
53
50
expect ( this . result [ 3 ] ) . to . eq ( '4433555 555666096667775553' )
54
51
} )
55
52
} )
56
53
57
54
describe ( 'convert' , ( ) => {
58
-
59
- before ( function ( ) {
55
+ before ( function ( ) {
60
56
this . result = convert ( `2\n hi\nyes` )
61
57
} )
62
58
63
- it ( 'returns single string' , function ( ) {
59
+ it ( 'returns single string' , function ( ) {
64
60
expect ( this . result ) . to . be . a ( 'String' )
65
61
} )
66
62
67
- it ( 'format each line' , function ( ) {
63
+ it ( 'format each line' , function ( ) {
68
64
expect ( this . result ) . to . eq ( 'Case #1: 044 444\nCase #2: 999337777' )
69
65
} )
70
-
71
66
} )
72
67
73
68
describe ( 'default' , ( ) => {
74
-
75
- before ( function ( ) {
69
+ before ( function ( ) {
76
70
this . writeFile = td . replace ( io , 'writeFile' )
77
71
const readAsString = td . replace ( io , 'readAsString' )
78
72
const input = `2\nfoo bar\nboo`
79
73
td . when ( readAsString ( 'input.file' ) ) . thenReturn ( Promise . resolve ( input ) )
80
74
} )
81
75
82
- afterEach ( function ( ) {
76
+ afterEach ( function ( ) {
83
77
td . reset ( )
84
78
} )
85
79
86
- it ( 'calls readAsString' , function ( ) {
80
+ it ( 'calls readAsString' , function ( ) {
87
81
return t9 ( 'input.file' ) . then ( ( ) => {
88
82
// console.log(td.explain(this.writeFile).description)
89
83
td . verify ( this . writeFile ( 'Case #1: 333666 6660 022 2777\nCase #2: 22666 666' ) )
90
84
} )
91
85
} )
92
-
93
86
} )
94
87
} )
0 commit comments