album.test.js 571 B

12345678910111213141516171819202122232425
  1. const assert = require('assert')
  2. const { default: axios } = require('axios')
  3. const host = global.host || 'http://localhost:3000'
  4. describe('测试获取歌手专辑列表是否正常', () => {
  5. it('数据的 code 应该为200', (done) => {
  6. const qs = {
  7. id: 32311,
  8. realIP: global.cnIp,
  9. }
  10. axios
  11. .get(`${host}/album`, {
  12. params: qs,
  13. })
  14. .then(({ status, data }) => {
  15. if (status == 200) {
  16. assert(data.code === 200)
  17. }
  18. done()
  19. })
  20. .catch((err) => {
  21. done(err)
  22. })
  23. })
  24. })