Skip to content

Commit 6901103

Browse files
committed
test
1 parent de05842 commit 6901103

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

client/modules/IDE/components/SketchList.unit.test.jsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,18 @@ describe('<Sketchlist />', () => {
8181

8282
it('renders component correctly', () => {
8383
const { container } = subject();
84-
85-
expect(container.querySelector('.sketches-table-container')).toBeInTheDocument();
84+
85+
expect(
86+
container.querySelector('.sketches-table-container')
87+
).toBeInTheDocument();
8688
expect(container.querySelector('.sketches-table')).toBeInTheDocument();
8789
expect(container.querySelector('thead')).toBeInTheDocument();
8890
expect(container.querySelector('tbody')).toBeInTheDocument();
89-
91+
9092
// expect(screen.getByText(/Sketch/i)).toBeInTheDocument();
9193
// expect(screen.getByText(/Date created/i)).toBeInTheDocument();
9294
// expect(screen.getByText(/Last updated/i)).toBeInTheDocument();
93-
95+
9496
const sketchRows = container.querySelectorAll('tbody tr');
9597
expect(sketchRows.length).toBeGreaterThan(0);
9698
});

server/controllers/collection.controller/listCollections.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export default async function listCollections(req, res) {
3030
return sendFailure({ code: 404, message: 'User not found' });
3131
}
3232

33-
let collections = await Collection.find({ owner: ownerId }).populate([
33+
const collections = await Collection.find({ owner: ownerId }).populate([
3434
{ path: 'owner', select: ['id', 'username'] },
3535
{
3636
path: 'items.project',
@@ -49,8 +49,8 @@ export default async function listCollections(req, res) {
4949
}
5050

5151
const publicCollections = collections.map((collection) => {
52-
let items = collection.items;
53-
items = items.filter(
52+
const { items: originalItems } = collection;
53+
const items = originalItems.filter(
5454
(item) => item.project && item.project.visibility === 'Public'
5555
);
5656
return {
@@ -60,11 +60,11 @@ export default async function listCollections(req, res) {
6060
};
6161
});
6262

63-
sendSuccess(publicCollections);
63+
return sendSuccess(publicCollections);
6464
} catch (error) {
65-
sendFailure({
65+
return sendFailure({
6666
code: error.code || 500,
6767
message: error.message || 'Something went wrong'
6868
});
6969
}
70-
}
70+
}

0 commit comments

Comments
 (0)