Skip to content

Commit

Permalink
chore: fix djradio pagnition
Browse files Browse the repository at this point in the history
  • Loading branch information
magicdawn committed Oct 18, 2020
1 parent 840e081 commit def805d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 27 deletions.
5 changes: 5 additions & 0 deletions .mocharc.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
extension: [ts]

# spec: 'test/**/*.spec.ts'

require:
- ts-node/register
- should

recursive: true
Expand Down
1 change: 1 addition & 0 deletions src/api/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ export async function djradioPrograms(id: StringOrNumber) {
do {
const res = await Api.dj_program({
rid: id,
limit: pagesize,
offset: (pagenum - 1) * pagesize,
asc: 'false', // lastest published first
})
Expand Down
8 changes: 0 additions & 8 deletions test/api/program-detail.js

This file was deleted.

11 changes: 11 additions & 0 deletions test/api/program-detail.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import {djradioPrograms} from '../../src/api'
import 'should'

describe('djradioPrograms', function () {
it('it works', async () => {
// https://music.163.com/#/djradio?id=334619056
debugger
const allPrograms = await djradioPrograms('334619056')
allPrograms.length.should.aboveOrEqual(400)
})
})
17 changes: 0 additions & 17 deletions test/lib/adapter/djradio.js

This file was deleted.

5 changes: 3 additions & 2 deletions test/util.js → test/util.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const {normalizeUrl, getId} = require('../lib/util.js')
import {normalizeUrl, getId} from '../src/util'
import 'should'

describe('util', function() {
describe('util', function () {
it('normalizeUrl', () => {
let url = 'http://music.163.com/#/playlist?id=12583200'
url = normalizeUrl(url)
Expand Down

0 comments on commit def805d

Please sign in to comment.