music_url.test.js 587 B

1234567891011121314151617181920212223242526
  1. const assert = require('assert')
  2. const { default: axios } = require('axios')
  3. const host = global.host || 'http://localhost:3000'
  4. describe('测试获取歌曲是否正常', () => {
  5. it('歌曲的 url 不应该为空', (done) => {
  6. const qs = {
  7. id: 464315036,
  8. br: 999000,
  9. realIP: global.cnIp,
  10. }
  11. axios
  12. .get(`${host}/song/url`, {
  13. params: qs,
  14. })
  15. .then(({ status, data }) => {
  16. if (status == 200) {
  17. assert(!!data.data[0].url)
  18. }
  19. done()
  20. })
  21. .catch((err) => {
  22. done(err)
  23. })
  24. })
  25. })