Browse Source

test: update error codes

Signed-off-by: Raju Udava <86527202+dstala@users.noreply.github.com>
pull/5901/head
Raju Udava 1 year ago
parent
commit
e495a98f60
  1. 38
      packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts

38
packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts

@ -559,19 +559,19 @@ function textBased() {
// Invalid table ID // Invalid table ID
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/base/${project.id}/tables/123456789`, url: `/api/v1/base/${project.id}/tables/123456789`,
status: 400, status: 404,
}); });
// Invalid project ID // Invalid project ID
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/base/123456789/tables/123456789`, url: `/api/v1/base/123456789/tables/123456789`,
status: 400, status: 404,
}); });
// Invalid view ID // Invalid view ID
await ncAxiosGet({ await ncAxiosGet({
query: { query: {
viewId: '123456789', viewId: '123456789',
}, },
status: 400, status: 422,
}); });
}); });
@ -607,7 +607,7 @@ function textBased() {
query: { query: {
offset: 10000, offset: 10000,
}, },
status: 200, status: 422,
}); });
}); });
@ -680,17 +680,17 @@ function textBased() {
// Invalid table ID // Invalid table ID
await ncAxiosPost({ await ncAxiosPost({
url: `/api/v1/base/${project.id}/tables/123456789`, url: `/api/v1/base/${project.id}/tables/123456789`,
status: 400, status: 404,
}); });
// Invalid project ID // Invalid project ID
await ncAxiosPost({ await ncAxiosPost({
url: `/api/v1/base/123456789/tables/123456789`, url: `/api/v1/base/123456789/tables/123456789`,
status: 400, status: 404,
}); });
// Invalid data - repeated ID // Invalid data - create should not specify ID
await ncAxiosPost({ await ncAxiosPost({
body: { ...newRecord, Id: 300 }, body: { ...newRecord, Id: 300 },
status: 400, status: 422,
}); });
// Invalid data - number instead of string // Invalid data - number instead of string
// await ncAxiosPost({ // await ncAxiosPost({
@ -718,12 +718,12 @@ function textBased() {
// Invalid table ID // Invalid table ID
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/base/tables/123456789/rows/100`, url: `/api/v1/base/tables/123456789/rows/100`,
status: 400, status: 404,
}); });
// Invalid row ID // Invalid row ID
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/base/tables/${table.id}/rows/1000`, url: `/api/v1/base/tables/${table.id}/rows/1000`,
status: 400, status: 404,
}); });
}); });
@ -804,17 +804,17 @@ function textBased() {
// Invalid project ID // Invalid project ID
await ncAxiosPatch({ await ncAxiosPatch({
url: `/api/v1/base/123456789/tables/${table.id}`, url: `/api/v1/base/123456789/tables/${table.id}`,
status: 400, status: 404,
}); });
// Invalid table ID // Invalid table ID
await ncAxiosPatch({ await ncAxiosPatch({
url: `/api/v1/base/${project.id}/tables/123456789`, url: `/api/v1/base/${project.id}/tables/123456789`,
status: 400, status: 404,
}); });
// Invalid row ID // Invalid row ID
await ncAxiosPatch({ await ncAxiosPatch({
body: { Id: 123456789, SingleLineText: 'some text' }, body: { Id: 123456789, SingleLineText: 'some text' },
status: 400, status: 422,
}); });
}); });
@ -832,7 +832,7 @@ function textBased() {
// // check that it's gone // // check that it's gone
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/base/tables/${table.id}/rows/1`, url: `/api/v1/base/tables/${table.id}/rows/1`,
status: 400, status: 404,
}); });
}); });
@ -843,11 +843,11 @@ function textBased() {
// check that it's gone // check that it's gone
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/base/tables/${table.id}/rows/1`, url: `/api/v1/base/tables/${table.id}/rows/1`,
status: 400, status: 404,
}); });
await ncAxiosGet({ await ncAxiosGet({
url: `/api/v1/base/tables/${table.id}/rows/2`, url: `/api/v1/base/tables/${table.id}/rows/2`,
status: 400, status: 404,
}); });
}); });
@ -857,15 +857,15 @@ function textBased() {
// Invalid project ID // Invalid project ID
await ncAxiosDelete({ await ncAxiosDelete({
url: `/api/v1/base/123456789/tables/${table.id}`, url: `/api/v1/base/123456789/tables/${table.id}`,
status: 400, status: 404,
}); });
// Invalid table ID // Invalid table ID
await ncAxiosDelete({ await ncAxiosDelete({
url: `/api/v1/base/${project.id}/tables/123456789`, url: `/api/v1/base/${project.id}/tables/123456789`,
status: 400, status: 404,
}); });
// Invalid row ID // Invalid row ID
await ncAxiosDelete({ body: { Id: 123456789 }, status: 400 }); await ncAxiosDelete({ body: { Id: 123456789 }, status: 422 });
}); });
} }

Loading…
Cancel
Save