Merge pull request #3582 from fnwbr/master
`POST /api/websites/<id>`: Make name and domain optional in the validation schema
This commit is contained in:
@@ -149,6 +149,21 @@ describe('Website API tests', () => {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('Updates a website with only shareId.', () => {
|
||||||
|
cy.request({
|
||||||
|
method: 'POST',
|
||||||
|
url: `/api/websites/${websiteId}`,
|
||||||
|
headers: {
|
||||||
|
'Content-Type': 'application/json',
|
||||||
|
Authorization: Cypress.env('authorization'),
|
||||||
|
},
|
||||||
|
body: { shareId: 'ABCDEF' },
|
||||||
|
}).then(response => {
|
||||||
|
expect(response.status).to.eq(200);
|
||||||
|
expect(response.body).to.have.property('shareId', 'ABCDEF');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
it('Resets a website by removing all data related to the website.', () => {
|
it('Resets a website by removing all data related to the website.', () => {
|
||||||
cy.request({
|
cy.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -31,8 +31,8 @@ export async function POST(
|
|||||||
{ params }: { params: Promise<{ websiteId: string }> },
|
{ params }: { params: Promise<{ websiteId: string }> },
|
||||||
) {
|
) {
|
||||||
const schema = z.object({
|
const schema = z.object({
|
||||||
name: z.string(),
|
name: z.string().optional(),
|
||||||
domain: z.string(),
|
domain: z.string().optional(),
|
||||||
shareId: z.string().regex(SHARE_ID_REGEX).nullable().optional(),
|
shareId: z.string().regex(SHARE_ID_REGEX).nullable().optional(),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user