Skip to content
26 changes: 18 additions & 8 deletions tests/System/integration/api/com_banners/Categories.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,27 @@ describe('Test that banners categories API endpoint', () => {
});

it('can create a category', () => {
cy.api_post('/banners/categories', { title: 'automated test banner category' })
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'automated test banner category'));
cy.api_post('/banners/categories', { title: 'automated test banner category', description: 'automated test banner category description' })
.then((response) => {
cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'automated test banner category');
cy.wrap(response).its('body').its('data').its('attributes')
.its('description')
.should('include', 'automated test banner category description');
});
});

it('can update a category', () => {
cy.db_createCategory({ title: 'automated test banner category', extension: 'com_banners' })
.then((id) => cy.api_patch(`/banners/categories/${id}`, { title: 'updated automated test banner category' }))
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'updated automated test banner category'));
.then((id) => cy.api_patch(`/banners/categories/${id}`, { title: 'updated automated test banner category', description: 'automated test banner category description' }))
.then((response) => {
cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'updated automated test banner category');
cy.wrap(response).its('body').its('data').its('attributes')
.its('description')
.should('include', 'automated test banner category description');
});
});
});
26 changes: 18 additions & 8 deletions tests/System/integration/api/com_contact/Categories.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,27 @@ describe('Test that contact categories API endpoint', () => {
});

it('can create a category', () => {
cy.api_post('/contacts/categories', { title: 'automated test contact category' })
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'automated test contact category'));
cy.api_post('/contacts/categories', { title: 'automated test contact category', description: 'automated test contact category description' })
.then((response) => {
cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'automated test contact category');
cy.wrap(response).its('body').its('data').its('attributes')
.its('description')
.should('include', 'automated test contact category description');
});
});

it('can update a category', () => {
cy.db_createCategory({ title: 'automated test contact category', extension: 'com_contact' })
.then((id) => cy.api_patch(`/contacts/categories/${id}`, { title: 'updated automated test contact category' }))
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'updated automated test contact category'));
.then((id) => cy.api_patch(`/contacts/categories/${id}`, { title: 'updated automated test contact category', description: 'automated test contact category description' }))
.then((response) => {
cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'updated automated test contact category');
cy.wrap(response).its('body').its('data').its('attributes')
.its('description')
.should('include', 'automated test contact category description');
});
});
});
26 changes: 18 additions & 8 deletions tests/System/integration/api/com_content/Categories.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,27 @@ describe('Test that content categories API endpoint', () => {
});

it('can create a category', () => {
cy.api_post('/content/categories', { title: 'automated test content category' })
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'automated test content category'));
cy.api_post('/content/categories', { title: 'automated test content category', description: 'automated test content category description' })
.then((response) => {
cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'automated test content category');
cy.wrap(response).its('body').its('data').its('attributes')
.its('description')
.should('include', 'automated test content category description');
});
});

it('can update a category', () => {
cy.db_createCategory({ title: 'automated test content category', extension: 'com_content' })
.then((id) => cy.api_patch(`/content/categories/${id}`, { title: 'updated automated test content category' }))
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'updated automated test content category'));
.then((id) => cy.api_patch(`/content/categories/${id}`, { title: 'updated automated test content category', description: 'automated test content category description' }))
.then((response) => {
cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'updated automated test content category');
cy.wrap(response).its('body').its('data').its('attributes')
.its('description')
.should('include', 'automated test content category description');
});
});
});
33 changes: 33 additions & 0 deletions tests/System/integration/api/com_newsfeed/Categories.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,37 @@ describe('Test that newsfeed categories API endpoint', () => {
.then(() => cy.api_get('/newsfeeds/categories'))
.then((response) => cy.api_responseContains(response, 'title', 'automated test category'));
});

it('can display a single category', () => {
cy.db_createCategory({ title: 'automated test feed category', extension: 'com_newsfeeds' })
.then((id) => cy.api_get(`/newsfeeds/categories/${id}`))
.then((response) => cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'automated test feed category'));
});

it('can create a category', () => {
cy.api_post('/newsfeeds/categories', { title: 'automated test feed category', description: 'automated test feed category description' })
.then((response) => {
cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'automated test feed category');
cy.wrap(response).its('body').its('data').its('attributes')
.its('description')
.should('include', 'automated test feed category description');
});
});

it('can update a category', () => {
cy.db_createCategory({ title: 'automated test feed category', extension: 'com_newsfeeds' })
.then((id) => cy.api_patch(`/newsfeeds/categories/${id}`, { title: 'updated automated test feed category', description: 'automated test feed category description' }))
.then((response) => {
cy.wrap(response).its('body').its('data').its('attributes')
.its('title')
.should('include', 'updated automated test feed category');
cy.wrap(response).its('body').its('data').its('attributes')
.its('description')
.should('include', 'automated test feed category description');
});
});
});