@@ -52,50 +52,50 @@ describe('Tournament', () => {
52
52
53
53
test ( 'just the header if no input' , ( ) => {
54
54
const tally = tournamentTally ( '' ) ;
55
- const expected = 'Team | MP | W | D | L | P' ;
55
+ const expected = 'Team | MP | W | D | L | P\n ' ;
56
56
expect ( tally ) . toEqual ( expected ) ;
57
57
} ) ;
58
58
xtest ( 'a win is three points, a loss is zero points' , ( ) => {
59
59
const tally = tournamentTally ( 'Allegoric Alaskans;Blithering Badgers;win' ) ;
60
60
const expected =
61
61
'Team | MP | W | D | L | P\n' +
62
62
'Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n' +
63
- 'Blithering Badgers | 1 | 0 | 0 | 1 | 0' ;
63
+ 'Blithering Badgers | 1 | 0 | 0 | 1 | 0\n ' ;
64
64
expect ( tally ) . toEqual ( expected ) ;
65
65
} ) ;
66
66
xtest ( 'a win can also be expressed as a loss' , ( ) => {
67
67
const tally = tournamentTally ( 'Blithering Badgers;Allegoric Alaskans;loss' ) ;
68
68
const expected =
69
69
'Team | MP | W | D | L | P\n' +
70
70
'Allegoric Alaskans | 1 | 1 | 0 | 0 | 3\n' +
71
- 'Blithering Badgers | 1 | 0 | 0 | 1 | 0' ;
71
+ 'Blithering Badgers | 1 | 0 | 0 | 1 | 0\n ' ;
72
72
expect ( tally ) . toEqual ( expected ) ;
73
73
} ) ;
74
74
xtest ( 'a different team can win' , ( ) => {
75
75
const tally = tournamentTally ( 'Blithering Badgers;Allegoric Alaskans;win' ) ;
76
76
const expected =
77
77
'Team | MP | W | D | L | P\n' +
78
78
'Blithering Badgers | 1 | 1 | 0 | 0 | 3\n' +
79
- 'Allegoric Alaskans | 1 | 0 | 0 | 1 | 0' ;
79
+ 'Allegoric Alaskans | 1 | 0 | 0 | 1 | 0\n ' ;
80
80
expect ( tally ) . toEqual ( expected ) ;
81
81
} ) ;
82
82
xtest ( 'a draw is one point each' , ( ) => {
83
83
const tally = tournamentTally ( 'Allegoric Alaskans;Blithering Badgers;draw' ) ;
84
84
const expected =
85
85
'Team | MP | W | D | L | P\n' +
86
86
'Allegoric Alaskans | 1 | 0 | 1 | 0 | 1\n' +
87
- 'Blithering Badgers | 1 | 0 | 1 | 0 | 1' ;
87
+ 'Blithering Badgers | 1 | 0 | 1 | 0 | 1\n ' ;
88
88
expect ( tally ) . toEqual ( expected ) ;
89
89
} ) ;
90
90
xtest ( 'there can be more than one match' , ( ) => {
91
91
const input =
92
92
'Allegoric Alaskans;Blithering Badgers;win\n' +
93
- 'Allegoric Alaskans;Blithering Badgers;win' ;
93
+ 'Allegoric Alaskans;Blithering Badgers;win\n ' ;
94
94
const tally = tournamentTally ( input ) ;
95
95
const expected =
96
96
'Team | MP | W | D | L | P\n' +
97
97
'Allegoric Alaskans | 2 | 2 | 0 | 0 | 6\n' +
98
- 'Blithering Badgers | 2 | 0 | 0 | 2 | 0' ;
98
+ 'Blithering Badgers | 2 | 0 | 0 | 2 | 0\n ' ;
99
99
expect ( tally ) . toEqual ( expected ) ;
100
100
} ) ;
101
101
xtest ( 'there can be more than one winner' , ( ) => {
@@ -106,7 +106,7 @@ describe('Tournament', () => {
106
106
const expected =
107
107
'Team | MP | W | D | L | P\n' +
108
108
'Allegoric Alaskans | 2 | 1 | 0 | 1 | 3\n' +
109
- 'Blithering Badgers | 2 | 1 | 0 | 1 | 3' ;
109
+ 'Blithering Badgers | 2 | 1 | 0 | 1 | 3\n ' ;
110
110
expect ( tally ) . toEqual ( expected ) ;
111
111
} ) ;
112
112
xtest ( 'there can be more than two teams' , ( ) => {
@@ -119,7 +119,7 @@ describe('Tournament', () => {
119
119
'Team | MP | W | D | L | P\n' +
120
120
'Allegoric Alaskans | 2 | 2 | 0 | 0 | 6\n' +
121
121
'Blithering Badgers | 2 | 1 | 0 | 1 | 3\n' +
122
- 'Courageous Californians | 2 | 0 | 0 | 2 | 0' ;
122
+ 'Courageous Californians | 2 | 0 | 0 | 2 | 0\n ' ;
123
123
expect ( tally ) . toEqual ( expected ) ;
124
124
} ) ;
125
125
xtest ( 'typical input' , ( ) => {
@@ -136,7 +136,7 @@ describe('Tournament', () => {
136
136
'Devastating Donkeys | 3 | 2 | 1 | 0 | 7\n' +
137
137
'Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n' +
138
138
'Blithering Badgers | 3 | 1 | 0 | 2 | 3\n' +
139
- 'Courageous Californians | 3 | 0 | 1 | 2 | 1' ;
139
+ 'Courageous Californians | 3 | 0 | 1 | 2 | 1\n ' ;
140
140
expect ( tally ) . toEqual ( expected ) ;
141
141
} ) ;
142
142
xtest ( 'incomplete competition (not all pairs have played)' , ( ) => {
@@ -151,7 +151,7 @@ describe('Tournament', () => {
151
151
'Allegoric Alaskans | 3 | 2 | 0 | 1 | 6\n' +
152
152
'Blithering Badgers | 2 | 1 | 1 | 0 | 4\n' +
153
153
'Courageous Californians | 2 | 0 | 1 | 1 | 1\n' +
154
- 'Devastating Donkeys | 1 | 0 | 0 | 1 | 0' ;
154
+ 'Devastating Donkeys | 1 | 0 | 0 | 1 | 0\n ' ;
155
155
expect ( tally ) . toEqual ( expected ) ;
156
156
} ) ;
157
157
xtest ( 'ties broken alphabetically' , ( ) => {
@@ -168,7 +168,7 @@ describe('Tournament', () => {
168
168
'Allegoric Alaskans | 3 | 2 | 1 | 0 | 7\n' +
169
169
'Courageous Californians | 3 | 2 | 1 | 0 | 7\n' +
170
170
'Blithering Badgers | 3 | 0 | 1 | 2 | 1\n' +
171
- 'Devastating Donkeys | 3 | 0 | 1 | 2 | 1' ;
171
+ 'Devastating Donkeys | 3 | 0 | 1 | 2 | 1\n ' ;
172
172
expect ( tally ) . toEqual ( expected ) ;
173
173
} ) ;
174
174
xtest ( 'ensure points sorted numerically' , ( ) => {
@@ -182,7 +182,7 @@ describe('Tournament', () => {
182
182
const expected =
183
183
'Team | MP | W | D | L | P\n' +
184
184
'Devastating Donkeys | 5 | 4 | 0 | 1 | 12\n' +
185
- 'Blithering Badgers | 5 | 1 | 0 | 4 | 3' ;
185
+ 'Blithering Badgers | 5 | 1 | 0 | 4 | 3\n ' ;
186
186
expect ( tally ) . toEqual ( expected ) ;
187
187
} ) ;
188
188
} ) ;
0 commit comments