Browse Source

test: unit test response

Signed-off-by: mertmit <mertmit99@gmail.com>
pull/6307/head
mertmit 1 year ago
parent
commit
304ac9910e
  1. 18
      packages/nocodb/tests/unit/rest/tests/newDataApis.test.ts

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

@ -120,6 +120,8 @@ let countryColumns;
let cityTable: Model;
let cityColumns;
const unauthorizedResponse = process.env.EE !== 'true' ? 404 : 403;
// Optimisation scope for time reduction
// 1. BeforeEach can be changed to BeforeAll for List and Read APIs
@ -795,7 +797,7 @@ function textBased() {
// Invalid table ID
await ncAxiosGet({
url: `/api/v1/tables/123456789/rows`,
status: 403,
status: unauthorizedResponse,
});
// Invalid view ID
@ -922,7 +924,7 @@ function textBased() {
// Invalid table ID
await ncAxiosPost({
url: `/api/v1/tables/123456789/rows`,
status: 403,
status: unauthorizedResponse,
});
// Invalid data - create should not specify ID
@ -956,7 +958,7 @@ function textBased() {
// Invalid table ID
await ncAxiosGet({
url: `/api/v1/tables/123456789/rows/100`,
status: 403,
status: unauthorizedResponse,
});
// Invalid row ID
await ncAxiosGet({
@ -1035,7 +1037,7 @@ function textBased() {
await ncAxiosPatch({
url: `/api/v1/tables/123456789/rows`,
body: { Id: 100, SingleLineText: 'some text' },
status: 403,
status: unauthorizedResponse,
});
// Invalid row ID
await ncAxiosPatch({
@ -1084,7 +1086,7 @@ function textBased() {
await ncAxiosDelete({
url: `/api/v1/tables/123456789/rows`,
body: { Id: 100 },
status: 403,
status: unauthorizedResponse,
});
// Invalid row ID
await ncAxiosDelete({ body: { Id: '123456789' }, status: 422 });
@ -2377,7 +2379,7 @@ function linkBased() {
await ncAxiosLinkAdd({
...validParams,
urlParams: { ...validParams.urlParams, tableId: 9999 },
status: 403,
status: unauthorizedResponse,
});
// Link Add: Invalid link ID
@ -2449,7 +2451,7 @@ function linkBased() {
await ncAxiosLinkRemove({
...validParams,
urlParams: { ...validParams.urlParams, tableId: 9999 },
status: 403,
status: unauthorizedResponse,
});
// Link Remove: Invalid link ID
@ -2521,7 +2523,7 @@ function linkBased() {
await ncAxiosLinkGet({
...validParams,
urlParams: { ...validParams.urlParams, tableId: 9999 },
status: 403,
status: unauthorizedResponse,
});
// Link List: Invalid link ID

Loading…
Cancel
Save