mirror of
https://github.com/KevinMidboe/vue-js-modal.git
synced 2025-10-29 18:00:20 +00:00
Added unit tests for "parser.js" and "util.js"
This commit is contained in:
26
test/unit/util.spec.js
Normal file
26
test/unit/util.spec.js
Normal file
@@ -0,0 +1,26 @@
|
||||
var util = require('../../src/util')
|
||||
var { expect } = require('chai')
|
||||
|
||||
describe('util.js', () => {
|
||||
describe('#inRange', () => {
|
||||
it('Should return the source value (in the range)', () => {
|
||||
let value = util.inRange(-10, 10, 0)
|
||||
expect(value).to.equal(0)
|
||||
})
|
||||
|
||||
it('Should not be equal to the source value (outside the range)', () => {
|
||||
let value = util.inRange(-10, 10, -100)
|
||||
expect(value).not.to.equal(-100)
|
||||
})
|
||||
|
||||
it('Should replace source value with upper limit', () => {
|
||||
let value = util.inRange(0, 10, 30)
|
||||
expect(value).to.equal(10)
|
||||
})
|
||||
|
||||
it('Should replace source value with lower limit', () => {
|
||||
let value = util.inRange(1, 10, -1)
|
||||
expect(value).to.equal(1)
|
||||
})
|
||||
})
|
||||
})
|
||||
Reference in New Issue
Block a user