forked from cypress-io/cypress
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrandom_spec.js
More file actions
32 lines (23 loc) · 717 Bytes
/
random_spec.js
File metadata and controls
32 lines (23 loc) · 717 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
require('../spec_helper')
const randomstring = require('randomstring')
const random = require(`${root}lib/util/random`)
context('.id', () => {
it('returns random.generate string with length 5 by default', () => {
sinon.spy(randomstring, 'generate')
const id = random.id()
expect(id.length).to.eq(5)
expect(randomstring.generate).to.be.calledWith({
length: 5,
capitalization: 'lowercase',
})
})
it('passes the length parameter if supplied', () => {
sinon.spy(randomstring, 'generate')
const id = random.id(32)
expect(id.length).to.eq(32)
expect(randomstring.generate).to.be.calledWith({
length: 32,
capitalization: 'lowercase',
})
})
})