Last active
March 3, 2019 22:08
-
-
Save haru01/a76b8ef3c2b8797fa09021553252be41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const generateReadedReport = require('./generateReadedReport'); | |
test('読書レポーター', () => { | |
const recommendList = [ | |
{asin: '0321146530' }, // Test Driven Development | |
{asin: '0596802293' }, // The Art of Readable Code | |
{asin: 'B005OYHF0A' }, // Working Effectively with Legacy Code | |
{asin: 'B075LRM681' }, // Clean Architecture | |
{asin: 'B07B9F83WM' }, // Accelerate | |
{asin: 'B07LCM8RG2' }, // Refactoring | |
]; | |
const readedList = { | |
name: 'bob', | |
books: [ | |
{ asin: '0321146530', name: 'Test Driven Development', times: 4 }, | |
{ asin: 'B075LRM681', name: 'Clean Architecture', times: 3 }, | |
{ asin: 'B07LCM8RG2', name: 'Refactoring', times: 2 }, | |
{ asin: 'B07B9F83WM', name: 'Accelerate', times: 1 }, | |
{ asin: 'B005OYHF0A', name: 'Working Effectively with Legacy Code', times: 0 }, | |
{ asin: 'B07NY221JL', name: 'Hamlet', times: 3 }, | |
{ asin: '1797994484', name: 'Othello', times: 0 }] | |
}; | |
const expected = | |
`name: bob | |
----- | |
- Test Driven Development: 8 point | |
- Clean Architecture: 8 point | |
- Refactoring: 5 point | |
- Accelerate: 3 point | |
- Hamlet: 1 point | |
----- | |
total: 25 point`; | |
const result = generateReadedReport(readedList, recommendList); | |
expect(result).toEqual(expected); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment