Notes Used to Craft this Lesson
What about testing a list of items? For this, we have our posts.index that returns an array of 3 different posts.
// app/controllers/posts_controller.ts
export default class PostsController {
// ...
async index() {
return [
{
id: 1,
title: 'My first post',
summary: 'Lorem ipsum dolor sit amet, consectetur ...',
},
{
id: 2,
title: 'My second post',
summary: 'Lorem ipsum dolor sit amet, consectetur ...',
},
{
id: 3,
title: 'My third post',
summary: 'Lorem ipsum dolor sit amet, consectetur ...',
},
]
}
// ...
}