lyric.test.js 573 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('数据应该有 lrc 字段', (done) => {
  6. const qs = {
  7. id: 347230,
  8. realIP: global.cnIp,
  9. }
  10. axios
  11. .get(`${host}/lyric`, {
  12. params: qs,
  13. })
  14. .then(({ status, data }) => {
  15. if (status == 200) {
  16. assert(typeof data.lrc !== 'undefined')
  17. }
  18. done()
  19. })
  20. .catch((err) => {
  21. done(err)
  22. })
  23. })
  24. })