diff options
Diffstat (limited to '__tests__/parser.test.js')
-rw-r--r-- | __tests__/parser.test.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/__tests__/parser.test.js b/__tests__/parser.test.js index 3c9f6ec..cb89ad5 100644 --- a/__tests__/parser.test.js +++ b/__tests__/parser.test.js @@ -325,6 +325,25 @@ describe('parse', () => { }) }) + it('parses dice with collecting', () => { + expect(parse('[2d6] x 1d4')).toEqual({ + type: 'repeat', + left: { + type: 'collect', + value: { + type: 'd', + left: { type: 'constant', value: 2 }, + right: { type: 'constant', value: 6 } + } + }, + right: { + type: 'd', + left: { type: 'constant', value: 1 }, + right: { type: 'constant', value: 4 } + } + }) + }) + describe('parsing parentheses', () => { test('(1d6)d6', () => { expect(parse('(1d6)d6')).toEqual({ |