Skip to content
This repository has been archived by the owner on Mar 26, 2024. It is now read-only.

Commit

Permalink
fix(test): extend tests to cover 100%
Browse files Browse the repository at this point in the history
  • Loading branch information
vaaski committed Feb 12, 2021
1 parent 2c25d6b commit ceff85b
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions tests/user.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,12 @@ test("get users likes using ID", async t => {
t.truthy(data.collection[0].track.id)
})

test("get users likes using ID without explicit limit", async t => {
const data = await user.likes(exampleUserID)
t.truthy(data)
t.truthy(data.collection[0].track.id)
})

test("get users likes using ID and client_id", async t => {
const data = await user.likes(exampleUserID, { limit: 2, client_id })
t.assert(data.collection.length === 2)
Expand Down
8 changes: 7 additions & 1 deletion tests/util.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import test from "ava"
import { user } from "../src"

import { at, getClientIDv2 } from "../src/util"
import { at, getClientIDv2, paginateNext } from "../src/util"

const testArray = ["one", "two", "three"]
const exampleUserID = Number(process.env.EXAMPLE_USER_ID) || 0
Expand Down Expand Up @@ -31,3 +31,9 @@ test("pagination works as expected", async t => {
t.notDeepEqual(data0.collection[0], data1?.collection[0])
t.assert(data0.collection[0].track.id !== data1?.collection[0].track.id)
})

// TODO write a better test than this
test("pagination without explicit params", t => {
const paginated = paginateNext("")
t.assert(typeof paginated === "function")
})

0 comments on commit ceff85b

Please sign in to comment.