Skip to content

Commit

Permalink
test: add test for token->function
Browse files Browse the repository at this point in the history
  • Loading branch information
bugwheels94 committed Jul 5, 2022
1 parent b7592c9 commit bcab658
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/semantic-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ jobs:
cache: npm
node-version: 16
- run: npm ci
- run: npm test
- run: npm run build
- run: zip -r dist.zip dist
- run: npx semantic-release
Expand Down
13 changes: 13 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -386,4 +386,17 @@ describe('Ading Token', function () {
])
assert.equal(Mexp.eval('maxof5(7, 12, 23, 33, 2)'), 33)
})
it('token with absolute', function () {
Mexp.addToken([
{
type: 0,
token: 'positive',
show: 'positive',
value: function (a) {
return Math.abs(a)
},
},
])
assert.equal(Mexp.eval('root(positive(2-6))'), 2)
})
})

0 comments on commit bcab658

Please sign in to comment.