Closed guillecro closed 6 years ago
Done!
> core@3.0.0 test /home/zaqueo/www/core
> NODE_ENV=test mocha --recursive --timeout 10000
Community API (/api/v1/community)
As anonymous user
✓ GET (/) Anyone should be able to get the community data (95ms)
As an admin user
✓ should get access_token from auth provider (127ms)
✓ PUT (/) should be able to update a community info (43ms)
CustomForm API (/api/v1/custom-forms)
As anonymous user
✓ GET (/) Anyone should be able to get customForm (50ms)
As an admin user
✓ should get access_token from auth provider (133ms)
✓ POST (/) it should be able to create a new customForm
✓ PUT (/) it should be able to update document type
Documents API (/api/v1/documents)
As anonymous user
✓ GET (/) should not be able to list documents
✓ POST (/) should not be able to create a document
✓ GET (/:id) An anonymous user should not be able to get a unpublished document
✓ GET (/:id) An anonymous user should able to get a published document
As an "Accountable" user (Group member: Accountable - Role: accountable)
✓ should get access_token from auth provider (134ms)
✓ POST (/) it should be able to create a document
✓ POST (/) should fail because the permission -documentLimit- is set (Test is limited to 10 tries)
✓ GET (/) The author should be able to list its own documents, drafts or published
✓ GET (/:id) it should be to retrieve a document
✓ PUT (/:id) it should be to update a document (Ex: publishing the document)
✓ DELETE (/:id) it should be to delete a document
User API (/api/v1/users)
As an logged user
✓ should get access_token from auth provider (130ms)
✓ PUT (/) should be able to update "my" profile info
Community DB-APIs
✓ Community.create() should create a community (53ms)
✓ Community.get() should get the only community created in the database
✓ Community.update() should update the only community created in the database
CustomForm DB-APIs
✓ CustomForm.create() should create a customForm
✓ CustomForm.get() should get the only customForm created in the database
✓ CustomForm.update() should update a customForm
✓ CustomForm.list() should list customForms
✓ CustomForm.remove() should remove a customForm
Document DB-APIs
✓ Document.create() should create a document
✓ Document.get() should get a document
✓ Document.list() should list all documents
✓ Document.update() should modify a document
✓ Document.remove() should remove a document
User DB-APIs
✓ User.create() should create a user
✓ User.get() should get a user
✓ User.list() should list all users
✓ User.update() should modify a user
✓ User.remove() should remove a user
38 passing (1s)
For User model
PUT /api/v1/user/:id
orPUT /api/v1/user/edit
and get the user id from keycloak id?)For Documents
Remake the tests for documents, having in mind the refactoring of CustomType
POST /api/v1/documents
PUT /api/v1/documents
For Custom Forms
POST /api/v1/user/custom-forms
POST /api/v1/user/custom-forms
PUT /api/v1/user/custom-forms
Ideas?