describe('Category Modules', () => { it('fetches category modules from API', () => { cy.request({ url: '/api/category-modules', failOnStatusCode: false }).then(res => { if (res.status === 200) { expect(res.body).to.be.an('array') if (res.body.length > 0) { const cat = res.body[0] expect(cat).to.have.property('name') expect(cat).to.have.property('tag_name') expect(cat).to.have.property('icon') } } }) }) it('categories reference existing tags', () => { cy.request({ url: '/api/category-modules', failOnStatusCode: false }).then(catRes => { if (catRes.status !== 200) return cy.request('/api/tags').then(tagRes => { const tags = tagRes.body catRes.body.forEach(cat => { // Category's tag_name should correspond to a valid tag or recipes with that tag expect(cat.tag_name).to.be.a('string').and.not.be.empty }) }) }) }) })