Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 40 additions & 2 deletions src/restoreNames.test.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,48 @@
'use strict';

const { ExportConflictException } = require('@aws-sdk/client-dynamodb');

Check failure on line 3 in src/restoreNames.test.js

View workflow job for this annotation

GitHub Actions / build (12.x)

'ExportConflictException' is assigned a value but never used

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import seems to be unused in this test file. It's good practice to remove any unnecessary dependencies or leftover code.


describe('restoreNames', () => {
// const { restoreNames } = require('./restoreNames');
const { restoreNames } = require('./restoreNames');

it('should set the firstName from fullName when firstName is set as undefined ', () => {

Check failure on line 8 in src/restoreNames.test.js

View workflow job for this annotation

GitHub Actions / build (12.x)

Line 8 exceeds the maximum line length of 80
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 ', () => {

Check failure on line 22 in src/restoreNames.test.js

View workflow job for this annotation

GitHub Actions / build (12.x)

Line 22 exceeds the maximum line length of 80
const users = [
{
lastName: 'Holy',
fullName: 'Jack Holy',
},
]

restoreNames(users);

expect(users[0].firstName).toBe('Jack')
});

it('should ', () => {
it('should keep the firstName when firstName has a different value than fullName', () => {

Check failure on line 35 in src/restoreNames.test.js

View workflow job for this annotation

GitHub Actions / build (12.x)

Line 35 exceeds the maximum line length of 80
const users = [
{ firstName: 'Jack',
lastName: 'Holy',
fullName: 'John Holy',
},
]

restoreNames(users);

expect(users[0].firstName).toBe('Jack')
});

// write tests here

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current tests are good for individual cases. To make the test suite more comprehensive, consider adding a test for an array containing multiple user objects, some that need fixing and some that don't. Testing edge cases, like an empty array, would also be a valuable addition.

Expand Down
Loading