Browse Source

test(api): key name correction

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/3962/head
Pranav C 2 years ago
parent
commit
d4dcdccb27
  1. 25
      packages/nocodb/tests/unit/rest/tests/project.test.ts

25
packages/nocodb/tests/unit/rest/tests/project.test.ts

@ -261,7 +261,7 @@ function projectTest() {
.get(`/api/v1/db/meta/projects/${project.id}/audits`) .get(`/api/v1/db/meta/projects/${project.id}/audits`)
.set('xc-auth', context.token) .set('xc-auth', context.token)
.send() .send()
.expect(200); .expect(200)
}) })
@ -276,13 +276,30 @@ function projectTest() {
.send({}) .send({})
.expect(200) .expect(200)
.then(res => { .then(res => {
expect(res.body).to.have.all.keys('userCount', 'sharedBaseCount', 'projectCount','projects') expect(res.body).to.have.all.keys(
'userCount',
'sharedBaseCount',
'projectCount',
'projects',
)
expect(res.body).to.have.property('projectCount').to.eq(1) expect(res.body).to.have.property('projectCount').to.eq(1)
expect(res.body).to.have.property('projects').to.be.an('array') expect(res.body).to.have.property('projects').to.be.an('array')
expect(res.body.projects[0].tableCount.table).to.be.eq(3) expect(res.body.projects[0].tableCount.table).to.be.eq(3)
expect(res.body).to.have.nested.property('projects[0].tableCount.table').to.be.a('number') expect(res.body).to.have.nested.property('projects[0].tableCount.table').to.be.a('number')
expect(res.body).to.have.nested.property('projects[0].tableCount.view').to.be.a('number') expect(res.body).to.have.nested.property('projects[0].tableCount.view').to.be.a('number')
expect(res.body).to.have.nested.property('projects[0].viewCount').to.be.an('object').have.keys('formCount', 'gridCount', 'galleryCount', 'kanbanCount', 'total', 'sharedFormCount', 'sharedGridCount', 'sharedGalleryCount', 'sharedKanbanCount', 'sharedTotal', 'sharedPasswordProtected') expect(res.body).to.have.nested.property('projects[0].viewCount').to.be.an('object')
.have.keys(
'formCount',
'gridCount',
'galleryCount',
'kanbanCount',
'total',
'sharedFormCount',
'sharedGridCount',
'sharedGalleryCount',
'sharedKanbanCount',
'sharedTotal',
'sharedLockedCount')
expect(res.body.projects[0]).have.keys( expect(res.body.projects[0]).have.keys(
'webhookCount', 'webhookCount',
'filterCount', 'filterCount',
@ -290,7 +307,7 @@ function projectTest() {
'userCount', 'userCount',
'rowCount', 'rowCount',
'tableCount', 'tableCount',
'viewCount' 'viewCount',
) )
expect(res.body).to.have.nested.property('projects[0].rowCount').to.be.an('array') expect(res.body).to.have.nested.property('projects[0].rowCount').to.be.an('array')
}) })

Loading…
Cancel
Save