forked from jsmapr1/simplifying-js
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patharrow.spec.js
More file actions
52 lines (42 loc) · 1.33 KB
/
arrow.spec.js
File metadata and controls
52 lines (42 loc) · 1.33 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
import expect from 'expect';
import { greetWithExcitement, key, capitalize, greet, formatUser } from './arrow';
import {
key as keyF,
capitalize as capitalizeF,
formatUser as formatUserF,
greetWithExcitement as greetWithExcitementF,
} from './full';
describe('full functions', () => {
it('should take no parameters', () => {
expect(keyF()).toEqual('abc123');
});
it('should take one parameter', () => {
expect(capitalizeF('joe')).toEqual('Joe');
});
it('should take several parameters', () => {
expect(greetWithExcitementF('joe')).toEqual('Hi, Joe!');
});
it('should have implicit return', () => {
expect(formatUserF('joe')).toEqual('Joe is logged in.');
});
it('should take a callback', () => {
expect(greetWithExcitementF()).toEqual('Hi, Joe!');
});
});
describe('arrow functions', () => {
it('should take no parameters', () => {
expect(key()).toEqual('abc123');
});
it('should take one parameter', () => {
expect(capitalize('joe')).toEqual('Joe');
});
it('should take several parameters', () => {
expect(greet('joe', 'morgan')).toEqual('Hello, Joe Morgan');
});
it('should have implicit return', () => {
expect(formatUser('joe')).toEqual('Joe is logged in.');
});
it('should take a callback', () => {
expect(greetWithExcitement()).toEqual('Hi, Joe!');
});
});