forked from wellguimaraes/actionware
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetActionName.test.js
28 lines (22 loc) · 975 Bytes
/
getActionName.test.js
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
import getActionName from './getActionName'
describe('getActionName', () => {
it('should return action name with prefix', () => {
const actionName = getActionName('lorem:', 'ipsum', () => {})
const actionName2 = getActionName('lorem:', 'ipsum', () => {})
expect(actionName).to.equal('lorem:ipsum')
expect(actionName2).to.equal('lorem:ipsum_2')
})
it('should return the same when trying to get name for the same function and name', () => {
let fn = () => {}
const actionName = getActionName('lorem:', 'ipsum', fn)
const actionName2 = getActionName('lorem:', 'ipsum', fn)
expect(actionName).to.equal(actionName2)
})
it('should return different names for different functions with the same name', () => {
let fn1 = () => {}
let fn2 = () => {}
const actionName = getActionName('lorem:', 'ipsum', fn1)
const actionName2 = getActionName('lorem:', 'ipsum', fn2)
expect(actionName).not.to.equal(actionName2)
})
})