Skip to content

Conversation

@Steel68
Copy link

@Steel68 Steel68 commented Apr 25, 2018

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.

db.listPictures(null, 'desc'),
arrayInOrder(initialData, [2, 3, 4, 1]),
'It works in descending order.',
);
Copy link
Contributor

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.',
);
Copy link
Contributor

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.',
);
Copy link
Contributor

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;
}));
Copy link
Contributor

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));

Copy link
Contributor

@jacekkopecky jacekkopecky left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants