-
Notifications
You must be signed in to change notification settings - Fork 7
Test of the inmemory db module #12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
a few polishings coverage check
| db.listPictures(null, 'desc'), | ||
| arrayInOrder(initialData, [2, 3, 4, 1]), | ||
| 'It works in descending order.', | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's an alias for desc: z2a
| db.listPictures(null, 'rnd').length, | ||
| 4, | ||
| 'Returns the good number of values when random.', | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there's an alias for rnd: random
| db.listPictures(null), | ||
| arrayInOrder(initialData, [4, 3, 2, 1]), | ||
| 'The default case works.', | ||
| ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this test above fits better together with the new test below because the default order is the same as new.
| for (const id of order) { | ||
| retval.push(arr.find((x) => { | ||
| return x.id === id; | ||
| })); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just fyi, you don't need to change this here, but there's a shortcut for this:
retval.push(arr.find(x => x.id === id));
jacekkopecky
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, thanks, we'll see in autumn what we can do with this.
We have created tests for the file model-inmemory.js :
A few tests for the function listPictures that are testing every case of the switch.
Tests for the function deletePicture and its exceptions.
Tests for the function uploadPicture and its exception.
Added :
- Some tests to verify if files have been created and deleted.
- Some comments tnat were missing.
- Polishing.