Skip to content

Commit

Permalink
Add more test
Browse files Browse the repository at this point in the history
  • Loading branch information
hans00 committed Aug 13, 2023
1 parent b3e23e6 commit cc49968
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions __tests__/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,21 @@ describe('parse', () => {
})
})

it('mix array & object', () => {
chai.expect(parse('a[a][][a]&a[a][a]&a[a][][b]')).to.be.deep.equal({
a: { a: { 0: { a: '' }, a: '', 2:{ b: '' } } },
})
})

it('drop insecure key', () => {
chai.expect(parse('a[constructor][prototype][a]=1')).to.be.deep.equal({
a: undefined,
})
chai.expect(parse('a[toString]=1')).to.be.deep.equal({
a: undefined,
})
chai.expect(parse('a[__proto__]=1')).to.be.deep.equal({
a: undefined,
})
})
})

0 comments on commit cc49968

Please sign in to comment.