How to use Six method in storybook-root

Best JavaScript code snippet using storybook-root

Start.spec.ts

Source:Start.spec.ts Github

copy

Full Screen

1/**2 * Free Touch Pricker3 * @author Leigh Simpson <code@simpleigh.com>4 * @license GPL-3.05 * @copyright Copyright 2015-20 Leigh Simpson. All rights reserved.6 */7/* eslint-disable max-len */8import {9 testAbstractBlockImplementation,10} from '../../blocks/AbstractBlock.spec';11import { rounds, rowFromString, Stage as S } from '../../rows';12import { StringArray } from '../../visitors';13import { AbstractMethod, Carter, Erin, Stedman, StedmanJump } from '../methods';14import SixType from '../SixType';15import Start from '.';16describe('Start class', () => {17 testAbstractBlockImplementation(18 S.Cinques,19 (initialRow) => new Start(initialRow),20 [[S.Cinques, 2]],21 (fixture) => { (fixture as Start).rowIndex = 2; },22 );23 let start: Start;24 beforeEach(() => {25 start = new Start(rounds(S.Cinques));26 });27 it('obtains the default start from the chosen method', () => {28 const method = jasmine.createSpyObj('AbstractMethod', ['createSix']);29 method.defaultStartSixType = SixType.Cold;30 method.defaultStartRowIndex = 3;31 start = new Start(rounds(S.Cinques), method);32 expect(start.sixType).toBe(SixType.Cold);33 expect(start.rowIndex).toBe(3);34 });35 it('defaults to standard start for Carter', () => {36 start = new Start(rounds(S.Cinques), new Carter());37 expect(start.sixType).toBe(SixType.Eight);38 expect(start.rowIndex).toBe(8);39 });40 it('defaults to a standard start for Erin', () => {41 start = new Start(rounds(S.Cinques), new Erin());42 expect(start.sixType).toBe(SixType.Slow);43 expect(start.rowIndex).toBe(6);44 });45 it('defaults to a standard start for Stedman', () => {46 start = new Start(rounds(S.Cinques), new Stedman());47 expect(start.sixType).toBe(SixType.Quick);48 expect(start.rowIndex).toBe(4);49 });50 it('defaults to a standard start for Stedman Jump', () => {51 start = new Start(rounds(S.Cinques), new StedmanJump());52 expect(start.sixType).toBe(SixType.Hot);53 expect(start.rowIndex).toBe(6);54 });55 it('allows the six type to be set', () => {56 start.sixType = SixType.Slow;57 expect(start.sixType).toBe(SixType.Slow);58 });59 it('throws an exception if the six type is invalid', () => {60 expect(() => { start.sixType = SixType.Invalid; })61 .toThrowError("'invalid' blocks not allowed for this method");62 });63 it('checks the six type is valid for the chosen method', () => {64 const method = new Stedman();65 spyOn(method, 'checkSixType');66 start = new Start(rounds(S.Cinques), method);67 start.sixType = SixType.Slow;68 expect(method.checkSixType).toHaveBeenCalled();69 expect(method.checkSixType).toHaveBeenCalledWith(SixType.Slow);70 });71 it('checks the six type is valid for Carter', () => {72 start = new Start(rounds(S.Cinques), new Carter());73 expect(() => { start.sixType = SixType.Slow; }).toThrow();74 expect(() => { start.sixType = SixType.Quick; }).toThrow();75 expect(() => { start.sixType = SixType.Cold; }).toThrow();76 expect(() => { start.sixType = SixType.Hot; }).toThrow();77 expect(() => { start.sixType = SixType.Invalid; }).toThrow();78 });79 it('checks the six type is valid for Erin', () => {80 start = new Start(rounds(S.Cinques), new Erin());81 expect(() => { start.sixType = SixType.Quick; }).toThrow();82 expect(() => { start.sixType = SixType.Cold; }).toThrow();83 expect(() => { start.sixType = SixType.Hot; }).toThrow();84 expect(() => { start.sixType = SixType.Four; }).toThrow();85 expect(() => { start.sixType = SixType.Eight; }).toThrow();86 expect(() => { start.sixType = SixType.Invalid; }).toThrow();87 });88 it('checks the six type is valid for Stedman', () => {89 start = new Start(rounds(S.Cinques), new Erin());90 expect(() => { start.sixType = SixType.Cold; }).toThrow();91 expect(() => { start.sixType = SixType.Hot; }).toThrow();92 expect(() => { start.sixType = SixType.Four; }).toThrow();93 expect(() => { start.sixType = SixType.Eight; }).toThrow();94 expect(() => { start.sixType = SixType.Invalid; }).toThrow();95 });96 it('checks the six type is valid for Stedman Jump', () => {97 start = new Start(rounds(S.Cinques), new StedmanJump());98 expect(() => { start.sixType = SixType.Slow; }).toThrow();99 expect(() => { start.sixType = SixType.Quick; }).toThrow();100 expect(() => { start.sixType = SixType.Four; }).toThrow();101 expect(() => { start.sixType = SixType.Eight; }).toThrow();102 expect(() => { start.sixType = SixType.Invalid; }).toThrow();103 });104 it('allows the row index to be set', () => {105 start.rowIndex = 3;106 expect(start.rowIndex).toBe(3);107 });108 it('throws an exception if the row index is out of range', () => {109 expect(() => { start.rowIndex = 0; })110 .toThrowError("Row index '0' out of range");111 expect(() => { start.rowIndex = 7; })112 .toThrowError("Row index '7' out of range");113 });114 const indexTestCases: [SixType, new() => AbstractMethod, number][] = [115 [SixType.Slow, Erin, 6],116 [SixType.Quick, Stedman, 6],117 [SixType.Cold, StedmanJump, 6],118 [SixType.Hot, StedmanJump, 6],119 [SixType.Four, Carter, 4],120 [SixType.Eight, Carter, 8],121 ];122 it('exposes the last permitted row index for a six', () => {123 for (const [sixType, Method, maxIndex] of indexTestCases) {124 start = new Start(rounds(S.Cinques), new Method());125 start.sixType = sixType;126 expect(start.lastRowIndex).toBe(maxIndex);127 }128 });129 it('restricts the row index range based on the six type', () => {130 for (const [sixType, Method, maxIndex] of indexTestCases) {131 start = new Start(rounds(S.Cinques), new Method());132 start.sixType = sixType;133 // Following two lines should not raise an error134 start.rowIndex = 1;135 start.rowIndex = maxIndex;136 expect(() => { start.rowIndex = 0; }).toThrow();137 expect(() => { start.rowIndex = maxIndex + 1; }).toThrow();138 }139 });140 it('ensures the row index is valid when setting the six type', () => {141 start = new Start(rounds(S.Cinques), new Carter());142 start.sixType = SixType.Eight;143 start.rowIndex = 5;144 start.sixType = SixType.Four;145 expect(start.rowIndex).toBe(4);146 });147 it('provides read access to the method', () => {148 const method = new Stedman();149 start = new Start(rounds(S.Cinques), method);150 expect(start.method).toBe(method);151 });152 type StageTestCase<Expected> = [S, Expected];153 type StartPosition<Expected> = [number, SixType, StageTestCase<Expected>[]];154 const rowTestCases: StartPosition<string[]>[] = [155 [1, SixType.Quick, [156 [S.Triples, ['1325476', '3124567', '3215476', '2314567', '2135476']],157 [S.Caters, ['132547698', '312456789', '321547698', '231456789', '213547698']],158 [S.Cinques, ['132547698E0', '3124567890E', '321547698E0', '2314567890E', '213547698E0']],159 [S.Sextuples, ['132547698E0AT', '3124567890ETA', '321547698E0AT', '2314567890ETA', '213547698E0AT']],160 [S.Septuples, ['132547698E0ATCB', '3124567890ETABC', '321547698E0ATCB', '2314567890ETABC', '213547698E0ATCB']],161 ]],162 [2, SixType.Quick, [163 [S.Triples, ['2135476', '2314567', '3215476', '3124567']],164 [S.Caters, ['213547698', '231456789', '321547698', '312456789']],165 [S.Cinques, ['213547698E0', '2314567890E', '321547698E0', '3124567890E']],166 [S.Sextuples, ['213547698E0AT', '2314567890ETA', '321547698E0AT', '3124567890ETA']],167 [S.Septuples, ['213547698E0ATCB', '2314567890ETABC', '321547698E0ATCB', '3124567890ETABC']],168 ]],169 [3, SixType.Quick, [170 [S.Triples, ['1325476', '3124567', '3215476']],171 [S.Caters, ['132547698', '312456789', '321547698']],172 [S.Cinques, ['132547698E0', '3124567890E', '321547698E0']],173 [S.Sextuples, ['132547698E0AT', '3124567890ETA', '321547698E0AT']],174 [S.Septuples, ['132547698E0ATCB', '3124567890ETABC', '321547698E0ATCB']],175 ]],176 [4, SixType.Quick, [177 [S.Triples, ['2135476', '2314567']],178 [S.Caters, ['213547698', '231456789']],179 [S.Cinques, ['213547698E0', '2314567890E']],180 [S.Sextuples, ['213547698E0AT', '2314567890ETA']],181 [S.Septuples, ['213547698E0ATCB', '2314567890ETABC']],182 ]],183 [5, SixType.Quick, [184 [S.Triples, ['1325476']],185 [S.Caters, ['132547698']],186 [S.Cinques, ['132547698E0']],187 [S.Sextuples, ['132547698E0AT']],188 [S.Septuples, ['132547698E0ATCB']],189 ]],190 [6, SixType.Quick, [191 [S.Triples, []],192 [S.Caters, []],193 [S.Cinques, []],194 [S.Sextuples, []],195 [S.Septuples, []],196 ]],197 [1, SixType.Slow, [198 [S.Triples, ['2135476', '2314567', '3215476', '3124567', '1325476']],199 [S.Caters, ['213547698', '231456789', '321547698', '312456789', '132547698']],200 [S.Cinques, ['213547698E0', '2314567890E', '321547698E0', '3124567890E', '132547698E0']],201 [S.Sextuples, ['213547698E0AT', '2314567890ETA', '321547698E0AT', '3124567890ETA', '132547698E0AT']],202 [S.Septuples, ['213547698E0ATCB', '2314567890ETABC', '321547698E0ATCB', '3124567890ETABC', '132547698E0ATCB']],203 ]],204 [2, SixType.Slow, [205 [S.Triples, ['1325476', '3124567', '3215476', '2314567']],206 [S.Caters, ['132547698', '312456789', '321547698', '231456789']],207 [S.Cinques, ['132547698E0', '3124567890E', '321547698E0', '2314567890E']],208 [S.Sextuples, ['132547698E0AT', '3124567890ETA', '321547698E0AT', '2314567890ETA']],209 [S.Septuples, ['132547698E0ATCB', '3124567890ETABC', '321547698E0ATCB', '2314567890ETABC']],210 ]],211 [3, SixType.Slow, [212 [S.Triples, ['2135476', '2314567', '3215476']],213 [S.Caters, ['213547698', '231456789', '321547698']],214 [S.Cinques, ['213547698E0', '2314567890E', '321547698E0']],215 [S.Sextuples, ['213547698E0AT', '2314567890ETA', '321547698E0AT']],216 [S.Septuples, ['213547698E0ATCB', '2314567890ETABC', '321547698E0ATCB']],217 ]],218 [4, SixType.Slow, [219 [S.Triples, ['1325476', '3124567']],220 [S.Caters, ['132547698', '312456789']],221 [S.Cinques, ['132547698E0', '3124567890E']],222 [S.Sextuples, ['132547698E0AT', '3124567890ETA']],223 [S.Septuples, ['132547698E0ATCB', '3124567890ETABC']],224 ]],225 [5, SixType.Slow, [226 [S.Triples, ['2135476']],227 [S.Caters, ['213547698']],228 [S.Cinques, ['213547698E0']],229 [S.Sextuples, ['213547698E0AT']],230 [S.Septuples, ['213547698E0ATCB']],231 ]],232 [6, SixType.Slow, [233 [S.Triples, []],234 [S.Caters, []],235 [S.Cinques, []],236 [S.Sextuples, []],237 [S.Septuples, []],238 ]],239 [1, SixType.Cold, [240 [S.Triples, ['2315476', '3124567', '1235476', '2314567', '3125476']],241 [S.Caters, ['231547698', '312456789', '123547698', '231456789', '312547698']],242 [S.Cinques, ['231547698E0', '3124567890E', '123547698E0', '2314567890E', '312547698E0']],243 [S.Sextuples, ['231547698E0AT', '3124567890ETA', '123547698E0AT', '2314567890ETA', '312547698E0AT']],244 [S.Septuples, ['231547698E0ATCB', '3124567890ETABC', '123547698E0ATCB', '2314567890ETABC', '312547698E0ATCB']],245 ]],246 [2, SixType.Cold, [247 [S.Triples, ['2315476', '3124567', '1235476', '2314567']],248 [S.Caters, ['231547698', '312456789', '123547698', '231456789']],249 [S.Cinques, ['231547698E0', '3124567890E', '123547698E0', '2314567890E']],250 [S.Sextuples, ['231547698E0AT', '3124567890ETA', '123547698E0AT', '2314567890ETA']],251 [S.Septuples, ['231547698E0ATCB', '3124567890ETABC', '123547698E0ATCB', '2314567890ETABC']],252 ]],253 [3, SixType.Cold, [254 [S.Triples, ['2315476', '3124567', '1235476']],255 [S.Caters, ['231547698', '312456789', '123547698']],256 [S.Cinques, ['231547698E0', '3124567890E', '123547698E0']],257 [S.Sextuples, ['231547698E0AT', '3124567890ETA', '123547698E0AT']],258 [S.Septuples, ['231547698E0ATCB', '3124567890ETABC', '123547698E0ATCB']],259 ]],260 [4, SixType.Cold, [261 [S.Triples, ['2315476', '3124567']],262 [S.Caters, ['231547698', '312456789']],263 [S.Cinques, ['231547698E0', '3124567890E']],264 [S.Sextuples, ['231547698E0AT', '3124567890ETA']],265 [S.Septuples, ['231547698E0ATCB', '3124567890ETABC']],266 ]],267 [5, SixType.Cold, [268 [S.Triples, ['2315476']],269 [S.Caters, ['231547698']],270 [S.Cinques, ['231547698E0']],271 [S.Sextuples, ['231547698E0AT']],272 [S.Septuples, ['231547698E0ATCB']],273 ]],274 [6, SixType.Cold, [275 [S.Triples, []],276 [S.Caters, []],277 [S.Cinques, []],278 [S.Sextuples, []],279 [S.Septuples, []],280 ]],281 [1, SixType.Hot, [282 [S.Triples, ['3125476', '2314567', '1235476', '3124567', '2315476']],283 [S.Caters, ['312547698', '231456789', '123547698', '312456789', '231547698']],284 [S.Cinques, ['312547698E0', '2314567890E', '123547698E0', '3124567890E', '231547698E0']],285 [S.Sextuples, ['312547698E0AT', '2314567890ETA', '123547698E0AT', '3124567890ETA', '231547698E0AT']],286 [S.Septuples, ['312547698E0ATCB', '2314567890ETABC', '123547698E0ATCB', '3124567890ETABC', '231547698E0ATCB']],287 ]],288 [2, SixType.Hot, [289 [S.Triples, ['3125476', '2314567', '1235476', '3124567']],290 [S.Caters, ['312547698', '231456789', '123547698', '312456789']],291 [S.Cinques, ['312547698E0', '2314567890E', '123547698E0', '3124567890E']],292 [S.Sextuples, ['312547698E0AT', '2314567890ETA', '123547698E0AT', '3124567890ETA']],293 [S.Septuples, ['312547698E0ATCB', '2314567890ETABC', '123547698E0ATCB', '3124567890ETABC']],294 ]],295 [3, SixType.Hot, [296 [S.Triples, ['3125476', '2314567', '1235476']],297 [S.Caters, ['312547698', '231456789', '123547698']],298 [S.Cinques, ['312547698E0', '2314567890E', '123547698E0']],299 [S.Sextuples, ['312547698E0AT', '2314567890ETA', '123547698E0AT']],300 [S.Septuples, ['312547698E0ATCB', '2314567890ETABC', '123547698E0ATCB']],301 ]],302 [4, SixType.Hot, [303 [S.Triples, ['3125476', '2314567']],304 [S.Caters, ['312547698', '231456789']],305 [S.Cinques, ['312547698E0', '2314567890E']],306 [S.Sextuples, ['312547698E0AT', '2314567890ETA']],307 [S.Septuples, ['312547698E0ATCB', '2314567890ETABC']],308 ]],309 [5, SixType.Hot, [310 [S.Triples, ['3125476']],311 [S.Caters, ['312547698']],312 [S.Cinques, ['312547698E0']],313 [S.Sextuples, ['312547698E0AT']],314 [S.Septuples, ['312547698E0ATCB']],315 ]],316 [6, SixType.Hot, [317 [S.Triples, []],318 [S.Caters, []],319 [S.Cinques, []],320 [S.Sextuples, []],321 [S.Septuples, []],322 ]],323 [1, SixType.Four, [324 [S.Triples, ['2135476', '2314567', '3215476']],325 [S.Caters, ['213547698', '231456789', '321547698']],326 [S.Cinques, ['213547698E0', '2314567890E', '321547698E0']],327 [S.Sextuples, ['213547698E0AT', '2314567890ETA', '321547698E0AT']],328 [S.Septuples, ['213547698E0ATCB', '2314567890ETABC', '321547698E0ATCB']],329 ]],330 [2, SixType.Four, [331 [S.Triples, ['1325476', '3124567']],332 [S.Caters, ['132547698', '312456789']],333 [S.Cinques, ['132547698E0', '3124567890E']],334 [S.Sextuples, ['132547698E0AT', '3124567890ETA']],335 [S.Septuples, ['132547698E0ATCB', '3124567890ETABC']],336 ]],337 [3, SixType.Four, [338 [S.Triples, ['2135476']],339 [S.Caters, ['213547698']],340 [S.Cinques, ['213547698E0']],341 [S.Sextuples, ['213547698E0AT']],342 [S.Septuples, ['213547698E0ATCB']],343 ]],344 [4, SixType.Four, [345 [S.Triples, []],346 [S.Caters, []],347 [S.Cinques, []],348 [S.Sextuples, []],349 [S.Septuples, []],350 ]],351 [1, SixType.Eight, [352 [S.Triples, ['1325476', '3124567', '1342576', '3145267', '1354276', '3152467', '3514276']],353 [S.Caters, ['132547698', '312456789', '134257698', '314526789', '135427698', '315246789', '351427698']],354 [S.Cinques, ['132547698E0', '3124567890E', '134257698E0', '3145267890E', '135427698E0', '3152467890E', '351427698E0']],355 [S.Sextuples, ['132547698E0AT', '3124567890ETA', '134257698E0AT', '3145267890ETA', '135427698E0AT', '3152467890ETA', '351427698E0AT']],356 [S.Septuples, ['132547698E0ATCB', '3124567890ETABC', '134257698E0ATCB', '3145267890ETABC', '135427698E0ATCB', '3152467890ETABC', '351427698E0ATCB']],357 ]],358 [2, SixType.Eight, [359 [S.Triples, ['2135476', '1253467', '2154376', '1245367', '2143576', '2415367']],360 [S.Caters, ['213547698', '125346789', '215437698', '124536789', '214357698', '241536789']],361 [S.Cinques, ['213547698E0', '1253467890E', '215437698E0', '1245367890E', '214357698E0', '2415367890E']],362 [S.Sextuples, ['213547698E0AT', '1253467890ETA', '215437698E0AT', '1245367890ETA', '214357698E0AT', '2415367890ETA']],363 [S.Septuples, ['213547698E0ATCB', '1253467890ETABC', '215437698E0ATCB', '1245367890ETABC', '214357698E0ATCB', '2415367890ETABC']],364 ]],365 [3, SixType.Eight, [366 [S.Triples, ['2143576', '1245367', '2154376', '1253467', '1524376']],367 [S.Caters, ['214357698', '124536789', '215437698', '125346789', '152437698']],368 [S.Cinques, ['214357698E0', '1245367890E', '215437698E0', '1253467890E', '152437698E0']],369 [S.Sextuples, ['214357698E0AT', '1245367890ETA', '215437698E0AT', '1253467890ETA', '152437698E0AT']],370 [S.Septuples, ['214357698E0ATCB', '1245367890ETABC', '215437698E0ATCB', '1253467890ETABC', '152437698E0ATCB']],371 ]],372 [4, SixType.Eight, [373 [S.Triples, ['2135476', '1253467', '2154376', '2513467']],374 [S.Caters, ['213547698', '125346789', '215437698', '251346789']],375 [S.Cinques, ['213547698E0', '1253467890E', '215437698E0', '2513467890E']],376 [S.Sextuples, ['213547698E0AT', '1253467890ETA', '215437698E0AT', '2513467890ETA']],377 [S.Septuples, ['213547698E0ATCB', '1253467890ETABC', '215437698E0ATCB', '2513467890ETABC']],378 ]],379 [5, SixType.Eight, [380 [S.Triples, ['2143576', '1245367', '1423576']],381 [S.Caters, ['214357698', '124536789', '142357698']],382 [S.Cinques, ['214357698E0', '1245367890E', '142357698E0']],383 [S.Sextuples, ['214357698E0AT', '1245367890ETA', '142357698E0AT']],384 [S.Septuples, ['214357698E0ATCB', '1245367890ETABC', '142357698E0ATCB']],385 ]],386 [6, SixType.Eight, [387 [S.Triples, ['2135476', '2314567']],388 [S.Caters, ['213547698', '231456789']],389 [S.Cinques, ['213547698E0', '2314567890E']],390 [S.Sextuples, ['213547698E0AT', '2314567890ETA']],391 [S.Septuples, ['213547698E0ATCB', '2314567890ETABC']],392 ]],393 [7, SixType.Eight, [394 [S.Triples, ['1325476']],395 [S.Caters, ['132547698']],396 [S.Cinques, ['132547698E0']],397 [S.Sextuples, ['132547698E0AT']],398 [S.Septuples, ['132547698E0ATCB']],399 ]],400 [8, SixType.Eight, [401 [S.Triples, []],402 [S.Caters, []],403 [S.Cinques, []],404 [S.Sextuples, []],405 [S.Septuples, []],406 ]],407 ];408 const notationTestCases: StartPosition<string[]>[] = [409 [1, SixType.Quick, [410 [S.Triples, ['1', '3', '1', '3', '1']],411 [S.Caters, ['1', '3', '1', '3', '1']],412 [S.Cinques, ['1', '3', '1', '3', '1']],413 [S.Sextuples, ['1', '3', '1', '3', '1']],414 [S.Septuples, ['1', '3', '1', '3', '1']],415 ]],416 [2, SixType.Quick, [417 [S.Triples, ['3', '1', '3', '1']],418 [S.Caters, ['3', '1', '3', '1']],419 [S.Cinques, ['3', '1', '3', '1']],420 [S.Sextuples, ['3', '1', '3', '1']],421 [S.Septuples, ['3', '1', '3', '1']],422 ]],423 [3, SixType.Quick, [424 [S.Triples, ['1', '3', '1']],425 [S.Caters, ['1', '3', '1']],426 [S.Cinques, ['1', '3', '1']],427 [S.Sextuples, ['1', '3', '1']],428 [S.Septuples, ['1', '3', '1']],429 ]],430 [4, SixType.Quick, [431 [S.Triples, ['3', '1']],432 [S.Caters, ['3', '1']],433 [S.Cinques, ['3', '1']],434 [S.Sextuples, ['3', '1']],435 [S.Septuples, ['3', '1']],436 ]],437 [5, SixType.Quick, [438 [S.Triples, ['1']],439 [S.Caters, ['1']],440 [S.Cinques, ['1']],441 [S.Sextuples, ['1']],442 [S.Septuples, ['1']],443 ]],444 [6, SixType.Quick, [445 [S.Triples, []],446 [S.Caters, []],447 [S.Cinques, []],448 [S.Sextuples, []],449 [S.Septuples, []],450 ]],451 [1, SixType.Slow, [452 [S.Triples, ['3', '1', '3', '1', '3']],453 [S.Caters, ['3', '1', '3', '1', '3']],454 [S.Cinques, ['3', '1', '3', '1', '3']],455 [S.Sextuples, ['3', '1', '3', '1', '3']],456 [S.Septuples, ['3', '1', '3', '1', '3']],457 ]],458 [2, SixType.Slow, [459 [S.Triples, ['1', '3', '1', '3']],460 [S.Caters, ['1', '3', '1', '3']],461 [S.Cinques, ['1', '3', '1', '3']],462 [S.Sextuples, ['1', '3', '1', '3']],463 [S.Septuples, ['1', '3', '1', '3']],464 ]],465 [3, SixType.Slow, [466 [S.Triples, ['3', '1', '3']],467 [S.Caters, ['3', '1', '3']],468 [S.Cinques, ['3', '1', '3']],469 [S.Sextuples, ['3', '1', '3']],470 [S.Septuples, ['3', '1', '3']],471 ]],472 [4, SixType.Slow, [473 [S.Triples, ['1', '3']],474 [S.Caters, ['1', '3']],475 [S.Cinques, ['1', '3']],476 [S.Sextuples, ['1', '3']],477 [S.Septuples, ['1', '3']],478 ]],479 [5, SixType.Slow, [480 [S.Triples, ['3']],481 [S.Caters, ['3']],482 [S.Cinques, ['3']],483 [S.Sextuples, ['3']],484 [S.Septuples, ['3']],485 ]],486 [6, SixType.Slow, [487 [S.Triples, []],488 [S.Caters, []],489 [S.Cinques, []],490 [S.Sextuples, []],491 [S.Septuples, []],492 ]],493 [1, SixType.Cold, [494 [S.Triples, ["'2315476'", "'2315476'", "'2315476'", "'2315476'", "'2315476'"]],495 [S.Caters, ["'231547698'", "'231547698'", "'231547698'", "'231547698'", "'231547698'"]],496 [S.Cinques, ["'231547698E0'", "'231547698E0'", "'231547698E0'", "'231547698E0'", "'231547698E0'"]],497 [S.Sextuples, ["'231547698E0AT'", "'231547698E0AT'", "'231547698E0AT'", "'231547698E0AT'", "'231547698E0AT'"]],498 [S.Septuples, ["'231547698E0ATCB'", "'231547698E0ATCB'", "'231547698E0ATCB'", "'231547698E0ATCB'", "'231547698E0ATCB'"]],499 ]],500 [2, SixType.Cold, [501 [S.Triples, ["'2315476'", "'2315476'", "'2315476'", "'2315476'"]],502 [S.Caters, ["'231547698'", "'231547698'", "'231547698'", "'231547698'"]],503 [S.Cinques, ["'231547698E0'", "'231547698E0'", "'231547698E0'", "'231547698E0'"]],504 [S.Sextuples, ["'231547698E0AT'", "'231547698E0AT'", "'231547698E0AT'", "'231547698E0AT'"]],505 [S.Septuples, ["'231547698E0ATCB'", "'231547698E0ATCB'", "'231547698E0ATCB'", "'231547698E0ATCB'"]],506 ]],507 [3, SixType.Cold, [508 [S.Triples, ["'2315476'", "'2315476'", "'2315476'"]],509 [S.Caters, ["'231547698'", "'231547698'", "'231547698'"]],510 [S.Cinques, ["'231547698E0'", "'231547698E0'", "'231547698E0'"]],511 [S.Sextuples, ["'231547698E0AT'", "'231547698E0AT'", "'231547698E0AT'"]],512 [S.Septuples, ["'231547698E0ATCB'", "'231547698E0ATCB'", "'231547698E0ATCB'"]],513 ]],514 [4, SixType.Cold, [515 [S.Triples, ["'2315476'", "'2315476'"]],516 [S.Caters, ["'231547698'", "'231547698'"]],517 [S.Cinques, ["'231547698E0'", "'231547698E0'"]],518 [S.Sextuples, ["'231547698E0AT'", "'231547698E0AT'"]],519 [S.Septuples, ["'231547698E0ATCB'", "'231547698E0ATCB'"]],520 ]],521 [5, SixType.Cold, [522 [S.Triples, ["'2315476'"]],523 [S.Caters, ["'231547698'"]],524 [S.Cinques, ["'231547698E0'"]],525 [S.Sextuples, ["'231547698E0AT'"]],526 [S.Septuples, ["'231547698E0ATCB'"]],527 ]],528 [6, SixType.Cold, [529 [S.Triples, []],530 [S.Caters, []],531 [S.Cinques, []],532 [S.Sextuples, []],533 [S.Septuples, []],534 ]],535 [1, SixType.Hot, [536 [S.Triples, ["'3125476'", "'3125476'", "'3125476'", "'3125476'", "'3125476'"]],537 [S.Caters, ["'312547698'", "'312547698'", "'312547698'", "'312547698'", "'312547698'"]],538 [S.Cinques, ["'312547698E0'", "'312547698E0'", "'312547698E0'", "'312547698E0'", "'312547698E0'"]],539 [S.Sextuples, ["'312547698E0AT'", "'312547698E0AT'", "'312547698E0AT'", "'312547698E0AT'", "'312547698E0AT'"]],540 [S.Septuples, ["'312547698E0ATCB'", "'312547698E0ATCB'", "'312547698E0ATCB'", "'312547698E0ATCB'", "'312547698E0ATCB'"]],541 ]],542 [2, SixType.Hot, [543 [S.Triples, ["'3125476'", "'3125476'", "'3125476'", "'3125476'"]],544 [S.Caters, ["'312547698'", "'312547698'", "'312547698'", "'312547698'"]],545 [S.Cinques, ["'312547698E0'", "'312547698E0'", "'312547698E0'", "'312547698E0'"]],546 [S.Sextuples, ["'312547698E0AT'", "'312547698E0AT'", "'312547698E0AT'", "'312547698E0AT'"]],547 [S.Septuples, ["'312547698E0ATCB'", "'312547698E0ATCB'", "'312547698E0ATCB'", "'312547698E0ATCB'"]],548 ]],549 [3, SixType.Hot, [550 [S.Triples, ["'3125476'", "'3125476'", "'3125476'"]],551 [S.Caters, ["'312547698'", "'312547698'", "'312547698'"]],552 [S.Cinques, ["'312547698E0'", "'312547698E0'", "'312547698E0'"]],553 [S.Sextuples, ["'312547698E0AT'", "'312547698E0AT'", "'312547698E0AT'"]],554 [S.Septuples, ["'312547698E0ATCB'", "'312547698E0ATCB'", "'312547698E0ATCB'"]],555 ]],556 [4, SixType.Hot, [557 [S.Triples, ["'3125476'", "'3125476'"]],558 [S.Caters, ["'312547698'", "'312547698'"]],559 [S.Cinques, ["'312547698E0'", "'312547698E0'"]],560 [S.Sextuples, ["'312547698E0AT'", "'312547698E0AT'"]],561 [S.Septuples, ["'312547698E0ATCB'", "'312547698E0ATCB'"]],562 ]],563 [5, SixType.Hot, [564 [S.Triples, ["'3125476'"]],565 [S.Caters, ["'312547698'"]],566 [S.Cinques, ["'312547698E0'"]],567 [S.Sextuples, ["'312547698E0AT'"]],568 [S.Septuples, ["'312547698E0ATCB'"]],569 ]],570 [6, SixType.Hot, [571 [S.Triples, []],572 [S.Caters, []],573 [S.Cinques, []],574 [S.Sextuples, []],575 [S.Septuples, []],576 ]],577 [1, SixType.Four, [578 [S.Triples, ['3', '1', '3']],579 [S.Caters, ['3', '1', '3']],580 [S.Cinques, ['3', '1', '3']],581 [S.Sextuples, ['3', '1', '3']],582 [S.Septuples, ['3', '1', '3']],583 ]],584 [2, SixType.Four, [585 [S.Triples, ['1', '3']],586 [S.Caters, ['1', '3']],587 [S.Cinques, ['1', '3']],588 [S.Sextuples, ['1', '3']],589 [S.Septuples, ['1', '3']],590 ]],591 [3, SixType.Four, [592 [S.Triples, ['3']],593 [S.Caters, ['3']],594 [S.Cinques, ['3']],595 [S.Sextuples, ['3']],596 [S.Septuples, ['3']],597 ]],598 [4, SixType.Four, [599 [S.Triples, []],600 [S.Caters, []],601 [S.Cinques, []],602 [S.Sextuples, []],603 [S.Septuples, []],604 ]],605 [1, SixType.Eight, [606 [S.Triples, ['1', '3', '5', '3', '5', '3', '1']],607 [S.Caters, ['1', '3', '5', '3', '5', '3', '1']],608 [S.Cinques, ['1', '3', '5', '3', '5', '3', '1']],609 [S.Sextuples, ['1', '3', '5', '3', '5', '3', '1']],610 [S.Septuples, ['1', '3', '5', '3', '5', '3', '1']],611 ]],612 [2, SixType.Eight, [613 [S.Triples, ['3', '5', '3', '5', '3', '1']],614 [S.Caters, ['3', '5', '3', '5', '3', '1']],615 [S.Cinques, ['3', '5', '3', '5', '3', '1']],616 [S.Sextuples, ['3', '5', '3', '5', '3', '1']],617 [S.Septuples, ['3', '5', '3', '5', '3', '1']],618 ]],619 [3, SixType.Eight, [620 [S.Triples, ['5', '3', '5', '3', '1']],621 [S.Caters, ['5', '3', '5', '3', '1']],622 [S.Cinques, ['5', '3', '5', '3', '1']],623 [S.Sextuples, ['5', '3', '5', '3', '1']],624 [S.Septuples, ['5', '3', '5', '3', '1']],625 ]],626 [4, SixType.Eight, [627 [S.Triples, ['3', '5', '3', '1']],628 [S.Caters, ['3', '5', '3', '1']],629 [S.Cinques, ['3', '5', '3', '1']],630 [S.Sextuples, ['3', '5', '3', '1']],631 [S.Septuples, ['3', '5', '3', '1']],632 ]],633 [5, SixType.Eight, [634 [S.Triples, ['5', '3', '1']],635 [S.Caters, ['5', '3', '1']],636 [S.Cinques, ['5', '3', '1']],637 [S.Sextuples, ['5', '3', '1']],638 [S.Septuples, ['5', '3', '1']],639 ]],640 [6, SixType.Eight, [641 [S.Triples, ['3', '1']],642 [S.Caters, ['3', '1']],643 [S.Cinques, ['3', '1']],644 [S.Sextuples, ['3', '1']],645 [S.Septuples, ['3', '1']],646 ]],647 [7, SixType.Eight, [648 [S.Triples, ['1']],649 [S.Caters, ['1']],650 [S.Cinques, ['1']],651 [S.Sextuples, ['1']],652 [S.Septuples, ['1']],653 ]],654 [8, SixType.Eight, [655 [S.Triples, []],656 [S.Caters, []],657 [S.Cinques, []],658 [S.Sextuples, []],659 [S.Septuples, []],660 ]],661 ];662 const notationStringTestCases: StartPosition<string>[] = [663 [1, SixType.Quick, [664 [S.Triples, '+1.3.1.3.1'],665 [S.Caters, '+1.3.1.3.1'],666 [S.Cinques, '+1.3.1.3.1'],667 [S.Sextuples, '+1.3.1.3.1'],668 [S.Septuples, '+1.3.1.3.1'],669 ]],670 [2, SixType.Quick, [671 [S.Triples, '+3.1.3.1'],672 [S.Caters, '+3.1.3.1'],673 [S.Cinques, '+3.1.3.1'],674 [S.Sextuples, '+3.1.3.1'],675 [S.Septuples, '+3.1.3.1'],676 ]],677 [3, SixType.Quick, [678 [S.Triples, '+1.3.1'],679 [S.Caters, '+1.3.1'],680 [S.Cinques, '+1.3.1'],681 [S.Sextuples, '+1.3.1'],682 [S.Septuples, '+1.3.1'],683 ]],684 [4, SixType.Quick, [685 [S.Triples, '+3.1'],686 [S.Caters, '+3.1'],687 [S.Cinques, '+3.1'],688 [S.Sextuples, '+3.1'],689 [S.Septuples, '+3.1'],690 ]],691 [5, SixType.Quick, [692 [S.Triples, '+1'],693 [S.Caters, '+1'],694 [S.Cinques, '+1'],695 [S.Sextuples, '+1'],696 [S.Septuples, '+1'],697 ]],698 [6, SixType.Quick, [699 [S.Triples, '+'],700 [S.Caters, '+'],701 [S.Cinques, '+'],702 [S.Sextuples, '+'],703 [S.Septuples, '+'],704 ]],705 [1, SixType.Slow, [706 [S.Triples, '+3.1.3.1.3'],707 [S.Caters, '+3.1.3.1.3'],708 [S.Cinques, '+3.1.3.1.3'],709 [S.Sextuples, '+3.1.3.1.3'],710 [S.Septuples, '+3.1.3.1.3'],711 ]],712 [2, SixType.Slow, [713 [S.Triples, '+1.3.1.3'],714 [S.Caters, '+1.3.1.3'],715 [S.Cinques, '+1.3.1.3'],716 [S.Sextuples, '+1.3.1.3'],717 [S.Septuples, '+1.3.1.3'],718 ]],719 [3, SixType.Slow, [720 [S.Triples, '+3.1.3'],721 [S.Caters, '+3.1.3'],722 [S.Cinques, '+3.1.3'],723 [S.Sextuples, '+3.1.3'],724 [S.Septuples, '+3.1.3'],725 ]],726 [4, SixType.Slow, [727 [S.Triples, '+1.3'],728 [S.Caters, '+1.3'],729 [S.Cinques, '+1.3'],730 [S.Sextuples, '+1.3'],731 [S.Septuples, '+1.3'],732 ]],733 [5, SixType.Slow, [734 [S.Triples, '+3'],735 [S.Caters, '+3'],736 [S.Cinques, '+3'],737 [S.Sextuples, '+3'],738 [S.Septuples, '+3'],739 ]],740 [6, SixType.Slow, [741 [S.Triples, '+'],742 [S.Caters, '+'],743 [S.Cinques, '+'],744 [S.Sextuples, '+'],745 [S.Septuples, '+'],746 ]],747 [1, SixType.Cold, [748 [S.Triples, "'2315476', '2315476', '2315476', '2315476', '2315476'"],749 [S.Caters, "'231547698', '231547698', '231547698', '231547698', '231547698'"],750 [S.Cinques, "'231547698E0', '231547698E0', '231547698E0', '231547698E0', '231547698E0'"],751 [S.Sextuples, "'231547698E0AT', '231547698E0AT', '231547698E0AT', '231547698E0AT', '231547698E0AT'"],752 [S.Septuples, "'231547698E0ATCB', '231547698E0ATCB', '231547698E0ATCB', '231547698E0ATCB', '231547698E0ATCB'"],753 ]],754 [2, SixType.Cold, [755 [S.Triples, "'2315476', '2315476', '2315476', '2315476'"],756 [S.Caters, "'231547698', '231547698', '231547698', '231547698'"],757 [S.Cinques, "'231547698E0', '231547698E0', '231547698E0', '231547698E0'"],758 [S.Sextuples, "'231547698E0AT', '231547698E0AT', '231547698E0AT', '231547698E0AT'"],759 [S.Septuples, "'231547698E0ATCB', '231547698E0ATCB', '231547698E0ATCB', '231547698E0ATCB'"],760 ]],761 [3, SixType.Cold, [762 [S.Triples, "'2315476', '2315476', '2315476'"],763 [S.Caters, "'231547698', '231547698', '231547698'"],764 [S.Cinques, "'231547698E0', '231547698E0', '231547698E0'"],765 [S.Sextuples, "'231547698E0AT', '231547698E0AT', '231547698E0AT'"],766 [S.Septuples, "'231547698E0ATCB', '231547698E0ATCB', '231547698E0ATCB'"],767 ]],768 [4, SixType.Cold, [769 [S.Triples, "'2315476', '2315476'"],770 [S.Caters, "'231547698', '231547698'"],771 [S.Cinques, "'231547698E0', '231547698E0'"],772 [S.Sextuples, "'231547698E0AT', '231547698E0AT'"],773 [S.Septuples, "'231547698E0ATCB', '231547698E0ATCB'"],774 ]],775 [5, SixType.Cold, [776 [S.Triples, "'2315476'"],777 [S.Caters, "'231547698'"],778 [S.Cinques, "'231547698E0'"],779 [S.Sextuples, "'231547698E0AT'"],780 [S.Septuples, "'231547698E0ATCB'"],781 ]],782 [6, SixType.Cold, [783 [S.Triples, ''],784 [S.Caters, ''],785 [S.Cinques, ''],786 [S.Sextuples, ''],787 [S.Septuples, ''],788 ]],789 [1, SixType.Hot, [790 [S.Triples, "'3125476', '3125476', '3125476', '3125476', '3125476'"],791 [S.Caters, "'312547698', '312547698', '312547698', '312547698', '312547698'"],792 [S.Cinques, "'312547698E0', '312547698E0', '312547698E0', '312547698E0', '312547698E0'"],793 [S.Sextuples, "'312547698E0AT', '312547698E0AT', '312547698E0AT', '312547698E0AT', '312547698E0AT'"],794 [S.Septuples, "'312547698E0ATCB', '312547698E0ATCB', '312547698E0ATCB', '312547698E0ATCB', '312547698E0ATCB'"],795 ]],796 [2, SixType.Hot, [797 [S.Triples, "'3125476', '3125476', '3125476', '3125476'"],798 [S.Caters, "'312547698', '312547698', '312547698', '312547698'"],799 [S.Cinques, "'312547698E0', '312547698E0', '312547698E0', '312547698E0'"],800 [S.Sextuples, "'312547698E0AT', '312547698E0AT', '312547698E0AT', '312547698E0AT'"],801 [S.Septuples, "'312547698E0ATCB', '312547698E0ATCB', '312547698E0ATCB', '312547698E0ATCB'"],802 ]],803 [3, SixType.Hot, [804 [S.Triples, "'3125476', '3125476', '3125476'"],805 [S.Caters, "'312547698', '312547698', '312547698'"],806 [S.Cinques, "'312547698E0', '312547698E0', '312547698E0'"],807 [S.Sextuples, "'312547698E0AT', '312547698E0AT', '312547698E0AT'"],808 [S.Septuples, "'312547698E0ATCB', '312547698E0ATCB', '312547698E0ATCB'"],809 ]],810 [4, SixType.Hot, [811 [S.Triples, "'3125476', '3125476'"],812 [S.Caters, "'312547698', '312547698'"],813 [S.Cinques, "'312547698E0', '312547698E0'"],814 [S.Sextuples, "'312547698E0AT', '312547698E0AT'"],815 [S.Septuples, "'312547698E0ATCB', '312547698E0ATCB'"],816 ]],817 [5, SixType.Hot, [818 [S.Triples, "'3125476'"],819 [S.Caters, "'312547698'"],820 [S.Cinques, "'312547698E0'"],821 [S.Sextuples, "'312547698E0AT'"],822 [S.Septuples, "'312547698E0ATCB'"],823 ]],824 [6, SixType.Hot, [825 [S.Triples, ''],826 [S.Caters, ''],827 [S.Cinques, ''],828 [S.Sextuples, ''],829 [S.Septuples, ''],830 ]],831 [1, SixType.Four, [832 [S.Triples, '+3.1.3'],833 [S.Caters, '+3.1.3'],834 [S.Cinques, '+3.1.3'],835 [S.Sextuples, '+3.1.3'],836 [S.Septuples, '+3.1.3'],837 ]],838 [2, SixType.Four, [839 [S.Triples, '+1.3'],840 [S.Caters, '+1.3'],841 [S.Cinques, '+1.3'],842 [S.Sextuples, '+1.3'],843 [S.Septuples, '+1.3'],844 ]],845 [3, SixType.Four, [846 [S.Triples, '+3'],847 [S.Caters, '+3'],848 [S.Cinques, '+3'],849 [S.Sextuples, '+3'],850 [S.Septuples, '+3'],851 ]],852 [4, SixType.Four, [853 [S.Triples, '+'],854 [S.Caters, '+'],855 [S.Cinques, '+'],856 [S.Sextuples, '+'],857 [S.Septuples, '+'],858 ]],859 [1, SixType.Eight, [860 [S.Triples, '+1.3.5.3.5.3.1'],861 [S.Caters, '+1.3.5.3.5.3.1'],862 [S.Cinques, '+1.3.5.3.5.3.1'],863 [S.Sextuples, '+1.3.5.3.5.3.1'],864 [S.Septuples, '+1.3.5.3.5.3.1'],865 ]],866 [2, SixType.Eight, [867 [S.Triples, '+3.5.3.5.3.1'],868 [S.Caters, '+3.5.3.5.3.1'],869 [S.Cinques, '+3.5.3.5.3.1'],870 [S.Sextuples, '+3.5.3.5.3.1'],871 [S.Septuples, '+3.5.3.5.3.1'],872 ]],873 [3, SixType.Eight, [874 [S.Triples, '+5.3.5.3.1'],875 [S.Caters, '+5.3.5.3.1'],876 [S.Cinques, '+5.3.5.3.1'],877 [S.Sextuples, '+5.3.5.3.1'],878 [S.Septuples, '+5.3.5.3.1'],879 ]],880 [4, SixType.Eight, [881 [S.Triples, '+3.5.3.1'],882 [S.Caters, '+3.5.3.1'],883 [S.Cinques, '+3.5.3.1'],884 [S.Sextuples, '+3.5.3.1'],885 [S.Septuples, '+3.5.3.1'],886 ]],887 [5, SixType.Eight, [888 [S.Triples, '+5.3.1'],889 [S.Caters, '+5.3.1'],890 [S.Cinques, '+5.3.1'],891 [S.Sextuples, '+5.3.1'],892 [S.Septuples, '+5.3.1'],893 ]],894 [6, SixType.Eight, [895 [S.Triples, '+3.1'],896 [S.Caters, '+3.1'],897 [S.Cinques, '+3.1'],898 [S.Sextuples, '+3.1'],899 [S.Septuples, '+3.1'],900 ]],901 [7, SixType.Eight, [902 [S.Triples, '+1'],903 [S.Caters, '+1'],904 [S.Cinques, '+1'],905 [S.Sextuples, '+1'],906 [S.Septuples, '+1'],907 ]],908 [8, SixType.Eight, [909 [S.Triples, '+'],910 [S.Caters, '+'],911 [S.Cinques, '+'],912 [S.Sextuples, '+'],913 [S.Septuples, '+'],914 ]],915 ];916 const methodMap: Record<SixType, new() => AbstractMethod> = {917 [SixType.Slow]: Stedman,918 [SixType.Quick]: Stedman,919 [SixType.Cold]: StedmanJump,920 [SixType.Hot]: StedmanJump,921 [SixType.Four]: Carter,922 [SixType.Eight]: Carter,923 [SixType.Invalid]: Stedman,924 };925 const runRowTestCases = (testFn: (fixture: Start, rows: string[]) => void) => () => {926 for (const [rowIndex, sixType, testCases] of rowTestCases) {927 for (const [stage, rows] of testCases) {928 const fixture = new Start(929 rounds(stage),930 new methodMap[sixType](),931 );932 fixture.sixType = sixType;933 fixture.rowIndex = rowIndex;934 testFn(fixture, rows);935 }936 }937 };938 it('computes the notation correctly', () => {939 for (const [rowIndex, sixType, testCases] of notationTestCases) {940 for (const [stage, notation] of testCases) {941 const fixture = new Start(942 rounds(stage),943 new methodMap[sixType](),944 );945 fixture.sixType = sixType;946 fixture.rowIndex = rowIndex;947 expect(fixture.notation).toEqual(notation);948 }949 }950 });951 it('computes the notation string correctly', () => {952 for (const [rowIndex, sixType, testCases] of notationStringTestCases) {953 for (const [stage, notation] of testCases) {954 const fixture = new Start(955 rounds(stage),956 new methodMap[sixType](),957 );958 fixture.sixType = sixType;959 fixture.rowIndex = rowIndex;960 expect(fixture.getNotationString()).toEqual(notation);961 }962 }963 });964 it('computes the last row correctly', runRowTestCases(965 (fixture: Start, rows: string[]) => {966 const last = fixture.getLast();967 const stage = last.length;968 if (rows.length) {969 const expected = rows[rows.length - 1];970 expect(last).toEqual(rowFromString(expected, stage));971 } else {972 expect(last).toEqual(rowFromString('123', stage));973 }974 },975 ));976 it('computes the length correctly', runRowTestCases(977 (fixture: Start, rows: string[]) => {978 expect(fixture.rows).toBe(rows.length);979 },980 ));981 it('computes the rows correctly', runRowTestCases(982 (fixture: Start, rows: string[]) => {983 const visitor = new StringArray();984 fixture.accept(visitor);985 expect(visitor.strings).toEqual(rows);986 },987 ));988 describe('can set the row index and six type from strings:', () => {989 // Enumerate all possible starts and check the following flow:990 // Start -> text (`print`) -> Start (`setFromString`)991 const validSixTypes: [new() => AbstractMethod, SixType, number][] = [992 [Erin, SixType.Slow, 6],993 [Stedman, SixType.Quick, 6],994 [Stedman, SixType.Slow, 6],995 [StedmanJump, SixType.Cold, 6],996 [StedmanJump, SixType.Hot, 6],997 [Carter, SixType.Four, 4],998 [Carter, SixType.Eight, 8],999 ];1000 for (const [Method, sixType, maxIndex] of validSixTypes) {1001 const method = new Method();1002 start = new Start(rounds(S.Cinques), method);1003 start.sixType = sixType;1004 for (let rowIndex = 1; rowIndex <= maxIndex; rowIndex += 1) {1005 start.rowIndex = rowIndex;1006 const output = start.print('text');1007 // Ignore default start (produces no output)1008 if (!output) {1009 continue; // eslint-disable-line no-continue1010 }1011 const description = ''1012 + `a ${sixType} six start on row ${rowIndex}`1013 + ` for ${method.name}`;1014 it(description, () => {1015 // Reset start as beforeEach() rule will have overwritten1016 start = new Start(rounds(S.Cinques), method);1017 start.setFromString(output);1018 expect(start.sixType).toBe(sixType);1019 expect(start.rowIndex).toBe(rowIndex);1020 });1021 }1022 }1023 const testLoad = (1024 description: string,1025 input: string,1026 expectedRowIndex: number = 3,1027 expectedSixType: SixType = SixType.Slow,1028 ) => it(description, () => {1029 start.setFromString(input);1030 expect(start.sixType).toBe(expectedSixType);1031 expect(start.rowIndex).toBe(expectedRowIndex);1032 });1033 testLoad(1034 'an ordinary string',1035 'Start with rounds as the third row of a slow six',1036 );1037 testLoad(1038 'a string with a numeric ordinal',1039 'Start with rounds as the 3rd row of a slow six',1040 );1041 testLoad(1042 'a string with a bare number',1043 'Start with rounds as row 3 of a slow six',1044 );1045 testLoad(1046 'a string with extra content',1047 'Start at backstroke with rounds as the third row of a slow six',1048 );1049 testLoad(1050 'a string with much less content',1051 'Start 3 slow',1052 );1053 testLoad(1054 'a string with the number and six type reversed',1055 'Start in a slow six at the third row',1056 );1057 testLoad(1058 'a string with an ordinal number for the last row',1059 'Start with rounds as the sixth row of a slow six',1060 6,1061 );1062 testLoad(1063 'a string with the word "last" for the last row',1064 'Start with rounds as the last row of a slow six',1065 6,1066 );1067 it('a string with the six type missing', () => {1068 expect(() => start.setFromString('Start third'))1069 .toThrowError("Start 'Start third' missing type of block");1070 });1071 it('a string with the row index missing', () => {1072 expect(() => start.setFromString('Start slow'))1073 .toThrowError("Start 'Start slow' missing row index");1074 });1075 it('a string with a large row index', () => {1076 expect(() => start.setFromString('Start seventh slow'))1077 .toThrowError("Row index '7' out of range");1078 });1079 it('a string with a large row index for a Carter four', () => {1080 start = new Start(rounds(S.Cinques), new Carter());1081 expect(() => start.setFromString('Start four fifth'))1082 .toThrowError("Row index '5' out of range");1083 });1084 it('returns this when setting the start', () => {1085 expect(start.setFromString('Start slow third')).toBe(start);1086 });1087 it('strings for Carter', () => {1088 start = new Start(rounds(S.Cinques), new Carter());1089 start.setFromString('Start third of a four');1090 expect(start.sixType).toBe(SixType.Four);1091 expect(start.rowIndex).toBe(3);1092 start.setFromString('Start seventh of an eight');1093 expect(start.sixType).toBe(SixType.Eight);1094 expect(start.rowIndex).toBe(7);1095 start.setFromString('Start last of a four');1096 expect(start.sixType).toBe(SixType.Four);1097 expect(start.rowIndex).toBe(4);1098 start.setFromString('Start last of an eight');1099 expect(start.sixType).toBe(SixType.Eight);1100 expect(start.rowIndex).toBe(8);1101 });1102 });...

Full Screen

Full Screen

AbstractMethod.spec.ts

Source:AbstractMethod.spec.ts Github

copy

Full Screen

...43 };44 runProgressionTests((sixType) => {45 it(`can create a ${sixType} six for the first six`, () => {46 testCourse.setFirstSixType(sixType);47 const six = method.createSix(initialRow, testCourse, 1);48 expect(six.type).toBe(sixType);49 });50 });51 it('passes the initial row to created sixes', () => {52 const six = method.createSix(initialRow, testCourse, 42);53 expect(six.initialRow).toEqual(initialRow);54 });55 runProgressionTests((sixType, expected) => {56 it(`can create a ${expected} six for the second six`, () => {57 testCourse.setFirstSixType(sixType);58 const six = method.createSix(initialRow, testCourse, 2);59 expect(six.type).toBe(expected);60 });61 });62 it('can create a course worth of sixes correctly', () => {63 const maxIndex = method.getCourseLength(initialRow.length);64 let type = testCourse.firstSixType;65 for (let index = 1; index <= maxIndex; index += 1) {66 const six = method.createSix(initialRow, testCourse, index);67 expect(six.type).toBe(type);68 type = method.getNextSixType(type);69 }70 });71 runProgressionTests((sixType) => {72 it(`knows that a ${sixType} six is valid`, () => {73 expect(() => method.checkSixType(sixType)).not.toThrow();74 });75 });76 it(`starts a course with a ${defaultFirstSix} six by default`, () => {77 expect(method.defaultFirstSix).toBe(defaultFirstSix);78 });79 it('starts a course with a valid six by default', () => {80 expect(() => method.checkSixType(defaultFirstSix)).not.toThrow();...

Full Screen

Full Screen

AbstractMethod.ts

Source:AbstractMethod.ts Github

copy

Full Screen

...32 * @param initialRow initial row for the six33 * @param course course that will own the six34 * @param index index of six in the course35 */36 public abstract createSix(37 initialRow: Row,38 course: Course,39 index: number,40 ): AbstractSix;41 /**42 * Mapping from each valid six type to its successor43 */44 protected abstract readonly sixTypeProgression:45 Partial<Record<SixType, SixType>>;46 /**47 * Returns an array of valid six types48 */49 public getSixTypes(): SixType[] {50 return Object.getOwnPropertyNames(this.sixTypeProgression) as SixType[];...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { withA11y } from '@storybook/addon-a11y';2import { withKnobs } from '@storybook/addon-knobs';3import { withInfo } from '@storybook/addon-info';4import { withTests } from '@storybook/addon-jest';5import { withOptions } from '@storybook/addon-options';6import { withNotes } from '@storybook/addon-notes';7import { withViewport } from '@storybook/addon-viewport';8import { withBackgrounds } from '@storybook/addon-backgrounds';9import { withConsole } from '@storybook/addon-console';10import { withLinks } from '@storybook/addon-links';11];12export const parameters = {13 options: {14 },15 viewport: {16 {17 styles: {18 },19 },20 {21 styles: {22 },23 },24 {25 styles: {26 },27 },28 {29 styles: {30 },31 },32 {33 styles: {34 },35 },36 {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Six } from 'storybook-root';2console.log(Six);3import { Seven } from 'storybook-root';4console.log(Seven);5import { Eight } from 'storybook-root';6console.log(Eight);7import { Nine } from 'storybook-root';8console.log(Nine);9import { Ten } from 'storybook-root';10console.log(Ten);11import { Eleven } from 'storybook-root';12console.log(Eleven);13import { Twelve } from 'storybook-root';14console.log(Twelve);15import { Thirteen } from 'storybook-root';16console.log(Thirteen);17import { Fourteen } from 'storybook-root';18console.log(Fourteen);19import { Fifteen } from 'storybook-root';20console.log(Fifteen);21import { Sixteen } from 'storybook-root';22console.log(Sixteen);23import { Seventeen } from 'storybook-root';24console.log(Seventeen);25import { Eighteen } from 'storybook-root';26console.log(Eighteen);27import { Nineteen } from 'storybook-root';28console.log(Nineteen);29import { Twenty } from 'storybook-root';30console.log(Twenty);31import { TwentyOne } from 'storybook-root';32console.log(TwentyOne);33import { TwentyTwo } from 'storybook-root';34console.log(TwentyTwo);35import { TwentyThree } from 'storybook-root';36console.log(TwentyThree);37import { TwentyFour } from 'storybook

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf, action } from '@storybook/react';2import { linkTo } from '@storybook/addon-links';3storiesOf('Button', module)4 .add('with text', () => (5 <Button onClick={action('clicked')}>Hello Button</Button>6 .add('with some emoji', () => (7 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>8 .add('with some emoji and action link', () => (9 <Button onClick={linkTo('Button', 'with some emoji')}>😀 😎 👍 💯</Button>10 ));11import React from 'react';12import { shallow } from 'enzyme';13import { storiesOf, action } from '@storybook/react';14import { linkTo } from '@storybook/addon-links';15import { Button } from './test';16describe('Button', () => {17 it('should render with text', () => {18 const wrapper = shallow(19 <Button onClick={action('clicked')}>Hello Button</Button>20 );21 expect(wrapper).toMatchSnapshot();22 });23 it('should render with some emoji', () => {24 const wrapper = shallow(25 <Button onClick={action('clicked')}>😀 😎 👍 💯</Button>26 );27 expect(wrapper).toMatchSnapshot();28 });29 it('should render with some emoji and action link', () => {30 const wrapper = shallow(31 <Button onClick={linkTo('Button', 'with some emoji')}>😀 😎 👍 💯</Button>32 );33 expect(wrapper).toMatchSnapshot();34 });35});36import { configure } from '@storybook/react';37configure(require.context('../src', true, /\.stories\.js$/), module);38import { configure } from '@storybook/react';39configure(require.context('../src', true, /\.test\.js$/), module);40import '@storybook/addon-actions/register';41import '@storybook/addon-links/register';42import '@storybook/addon-actions/register';43const path = require('path');44module.exports = {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { storiesOf } from '@storybook/react';2import { withInfo } from '@storybook/addon-info';3import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';4import { action } from '@storybook/addon-actions';5import { Button } from './Button';6storiesOf('Button', module)7 .addDecorator(withKnobs)8 .addDecorator(withInfo)9 .addParameters({10 info: {11 styles: {12 infoBody: {13 },14 infoStory: {15 },16 },17 },18 })19 .add('with text', () => (20 onClick={action('clicked')}21 disabled={boolean('Disabled', false)}22 type={text('Type', 'primary')}23 size={number('Size', 1)}24 {text('Label', 'Hello Button')}25 .add('with some emoji', () => (26 <Button onClick={action('clicked')} disabled={boolean('Disabled', false)}>27 ));28import React from 'react';29import PropTypes from 'prop-types';30import { Button as AntButton } from 'antd';31const Button = ({ children, ...props }) => {32 return <AntButton {...props}>{children}</AntButton>;33};34Button.propTypes = {35};36export { Button };37import React from 'react';38import { storiesOf } from '@storybook/react';39import { withInfo } from '@storybook/addon-info';40import { withKnobs, text, boolean, number } from '@storybook/addon-knobs';41import { action } from '@storybook/addon-actions';42import { Button } from './Button';43storiesOf('Button', module)44 .addDecorator(withKnobs)45 .addDecorator(withInfo)46 .addParameters({47 info: {

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Six } from 'storybook-root';2import { Six } from 'storybook-root';3import { Six } from 'storybook-root';4import { Six } from 'storybook-root';5import { Six } from 'storybook-root';6import { Six } from 'storybook-root';7import { Six } from 'storybook-root';8import { Six } from 'storybook-root';9import { Six } from 'storybook-root';10import { Six } from 'storybook-root';11import { Six } from 'storybook-root';12import { Six } from 'storybook-root';13import { Six } from 'storybook-root';14import { Six } from 'storybook-root';15import { Six } from 'storybook-root';16import { Six } from 'storybook-root';17import { Six } from 'storybook-root';18import { Six } from 'storybook-root';19import { Six } from 'storybook-root';20import { Six } from 'storybook-root';21import { Six } from 'storybook-root';22import { Six } from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Six } from 'storybook-root'2import { Six } from 'storybook-root'3import { Six } from 'storybook-root'4import { Six } from 'storybook-root'5import { Six } from 'storybook-root'6import { Six } from 'storybook-root'7import { Six } from 'storybook-root'8import { Six } from 'storybook-root'9import { Six } from 'storybook-root'10import { Six } from 'storybook-root'11import { Six } from 'storybook-root'12import { Six } from 'storybook-root'13import { Six } from 'storybook-root'14import { Six } from 'storybook-root'

Full Screen

Using AI Code Generation

copy

Full Screen

1import { Six } from 'storybook-root';2import { Six } from 'storybook-root';3const story = Six('storyName', 'storyDescription');4const story = Six('storyName', 'storyDescription', () => {5 return (6 );7});8MIT © [Nikhil](

Full Screen

Using AI Code Generation

copy

Full Screen

1import Six from 'storybook-root/dist/Six'2const App = () => {3 return (4}5import React from 'react'6import ReactDOM from 'react-dom'7import App from './test'8ReactDOM.render(<App />, document.getElementById('root'))

Full Screen

Automation Testing Tutorials

Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run storybook-root automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful