m-chrzan.xyz
aboutsummaryrefslogtreecommitdiff
path: root/__tests__/parser.test.js
diff options
context:
space:
mode:
authorMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-23 21:30:01 -0400
committerMarcin Chrzanowski <marcin.j.chrzanowski@gmail.com>2017-08-23 21:30:01 -0400
commitfe1bb829ba1feeb4d8f384afe0ed62669d82407f (patch)
tree667520ac5019a24398255086d34460517421b8c8 /__tests__/parser.test.js
parent5bb027bde84e0a8fdb01bfa680b511ad842498ef (diff)
Lex and parse threshold
Diffstat (limited to '__tests__/parser.test.js')
-rw-r--r--__tests__/parser.test.js12
1 files changed, 12 insertions, 0 deletions
diff --git a/__tests__/parser.test.js b/__tests__/parser.test.js
index 6bf5958..70ad98d 100644
--- a/__tests__/parser.test.js
+++ b/__tests__/parser.test.js
@@ -211,6 +211,18 @@ describe('parse', () => {
})
})
+ it('parases dice with threshold', () => {
+ expect(parse('7T4d8')).toEqual({
+ type: 'T',
+ left: { type: 'constant', value: 7 },
+ right: {
+ type: 'd',
+ left: { type: 'constant', value: 4 },
+ right: { type: 'constant', value: 8 }
+ }
+ })
+ })
+
describe('parsing parentheses', () => {
test('(1d6)d6', () => {
expect(parse('(1d6)d6')).toEqual({