From e495a98f60d74cbc9ddf197db945cad29001782c Mon Sep 17 00:00:00 2001 From: Raju Udava <86527202+dstala@users.noreply.github.com> Date: Mon, 29 May 2023 18:07:55 +0530 Subject: [PATCH] test: update error codes Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com> --- .../tests/unit/rest/tests/newDataApis.test.ts | 38 +++++++++---------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts b/packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts index 76c53e5050..f2d278e01c 100644 --- a/packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts +++ b/packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts @@ -559,19 +559,19 @@ function textBased() { // Invalid table ID await ncAxiosGet({ url: `/api/v1/base/${project.id}/tables/123456789`, - status: 400, + status: 404, }); // Invalid project ID await ncAxiosGet({ url: `/api/v1/base/123456789/tables/123456789`, - status: 400, + status: 404, }); // Invalid view ID await ncAxiosGet({ query: { viewId: '123456789', }, - status: 400, + status: 422, }); }); @@ -607,7 +607,7 @@ function textBased() { query: { offset: 10000, }, - status: 200, + status: 422, }); }); @@ -680,17 +680,17 @@ function textBased() { // Invalid table ID await ncAxiosPost({ url: `/api/v1/base/${project.id}/tables/123456789`, - status: 400, + status: 404, }); // Invalid project ID await ncAxiosPost({ url: `/api/v1/base/123456789/tables/123456789`, - status: 400, + status: 404, }); - // Invalid data - repeated ID + // Invalid data - create should not specify ID await ncAxiosPost({ body: { ...newRecord, Id: 300 }, - status: 400, + status: 422, }); // Invalid data - number instead of string // await ncAxiosPost({ @@ -718,12 +718,12 @@ function textBased() { // Invalid table ID await ncAxiosGet({ url: `/api/v1/base/tables/123456789/rows/100`, - status: 400, + status: 404, }); // Invalid row ID await ncAxiosGet({ url: `/api/v1/base/tables/${table.id}/rows/1000`, - status: 400, + status: 404, }); }); @@ -804,17 +804,17 @@ function textBased() { // Invalid project ID await ncAxiosPatch({ url: `/api/v1/base/123456789/tables/${table.id}`, - status: 400, + status: 404, }); // Invalid table ID await ncAxiosPatch({ url: `/api/v1/base/${project.id}/tables/123456789`, - status: 400, + status: 404, }); // Invalid row ID await ncAxiosPatch({ body: { Id: 123456789, SingleLineText: 'some text' }, - status: 400, + status: 422, }); }); @@ -832,7 +832,7 @@ function textBased() { // // check that it's gone await ncAxiosGet({ url: `/api/v1/base/tables/${table.id}/rows/1`, - status: 400, + status: 404, }); }); @@ -843,11 +843,11 @@ function textBased() { // check that it's gone await ncAxiosGet({ url: `/api/v1/base/tables/${table.id}/rows/1`, - status: 400, + status: 404, }); await ncAxiosGet({ url: `/api/v1/base/tables/${table.id}/rows/2`, - status: 400, + status: 404, }); }); @@ -857,15 +857,15 @@ function textBased() { // Invalid project ID await ncAxiosDelete({ url: `/api/v1/base/123456789/tables/${table.id}`, - status: 400, + status: 404, }); // Invalid table ID await ncAxiosDelete({ url: `/api/v1/base/${project.id}/tables/123456789`, - status: 400, + status: 404, }); // Invalid row ID - await ncAxiosDelete({ body: { Id: 123456789 }, status: 400 }); + await ncAxiosDelete({ body: { Id: 123456789 }, status: 422 }); }); }