-
Notifications
You must be signed in to change notification settings - Fork 352
Expand file tree
/
Copy pathrestoreNames.test.js
More file actions
49 lines (37 loc) · 1.05 KB
/
restoreNames.test.js
File metadata and controls
49 lines (37 loc) · 1.05 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
'use strict';
const { ExportConflictException } = require('@aws-sdk/client-dynamodb');
describe('restoreNames', () => {
const { restoreNames } = require('./restoreNames');
it('should set the firstName from fullName when firstName is set as undefined ', () => {
const users = [
{
firstName: undefined,
lastName: 'Holy',
fullName: 'Jack Holy',
},
]
restoreNames(users);
expect(users[0].firstName).toBe('Jack')
});
it('should set the firstName from fullName when firstName is not set as property ', () => {
const users = [
{
lastName: 'Holy',
fullName: 'Jack Holy',
},
]
restoreNames(users);
expect(users[0].firstName).toBe('Jack')
});
it('should keep the firstName when firstName has a different value than fullName', () => {
const users = [
{ firstName: 'Jack',
lastName: 'Holy',
fullName: 'John Holy',
},
]
restoreNames(users);
expect(users[0].firstName).toBe('Jack')
});
// write tests here
});