accounts.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* tslint:disable:no-unused-expression */
  2. import 'mocha'
  3. import { cleanupTests, flushAndRunServer, ServerInfo } from '../../../../shared/extra-utils'
  4. import {
  5. checkBadCountPagination,
  6. checkBadSortPagination,
  7. checkBadStartPagination
  8. } from '../../../../shared/extra-utils/requests/check-api-params'
  9. import { getAccount } from '../../../../shared/extra-utils/users/accounts'
  10. describe('Test accounts API validators', function () {
  11. const path = '/api/v1/accounts/'
  12. let server: ServerInfo
  13. // ---------------------------------------------------------------
  14. before(async function () {
  15. this.timeout(30000)
  16. server = await flushAndRunServer(1)
  17. })
  18. describe('When listing accounts', function () {
  19. it('Should fail with a bad start pagination', async function () {
  20. await checkBadStartPagination(server.url, path, server.accessToken)
  21. })
  22. it('Should fail with a bad count pagination', async function () {
  23. await checkBadCountPagination(server.url, path, server.accessToken)
  24. })
  25. it('Should fail with an incorrect sort', async function () {
  26. await checkBadSortPagination(server.url, path, server.accessToken)
  27. })
  28. })
  29. describe('When getting an account', function () {
  30. it('Should return 404 with a non existing name', async function () {
  31. await getAccount(server.url, 'arfaze', 404)
  32. })
  33. })
  34. after(async function () {
  35. await cleanupTests([ server ])
  36. })
  37. })