Skip to content

Commit

Permalink
Added naive tests
Browse files Browse the repository at this point in the history
  • Loading branch information
devnoot committed Jan 24, 2023
1 parent b12c403 commit 8aa2d7f
Showing 1 changed file with 53 additions and 1 deletion.
54 changes: 53 additions & 1 deletion test/index.test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,17 @@
const assert = require('assert')
const { ping, dbPing, about, get, latestFiles } = require('../dist/index')
const {
ping,
dbPing,
about,
get,
getParentDir,
getDirs,
getFiles,
getContents,
latestVotes,
latestFiles,
search,
} = require('../dist/index')

describe('API Tests', () => {
it('ping', async () => {
Expand All @@ -25,8 +37,48 @@ describe('API Tests', () => {
assert(typeof res.content.title === 'string')
})

it('getparentdir', async () => {
const res = await getParentDir({ id: '666' })
assert(1)
})

it('getdirs', async () => {
const res = await getDirs({ name: 'zvox' })
assert(1)
})

it('getfiles by id', async () => {
const res = await getFiles({ id: '666' })
assert(1)
})

it('getfiles by name', async () => {
const res = await getFiles({ name: 'scythe2' })
assert(1)
})

it('getcontents by id', async () => {
const res = await getContents({ id: '666' })
assert(1)
})

it('getcontents by name', async () => {
const res = await getContents({ name: 'dwango' })
assert(1)
})

it('latestvotes', async () => {
const res = await latestVotes({ limit: 25 })
assert(1)
})

it('latestfiles', async () => {
const res = await latestFiles({ limit: 10 })
assert(res.content.file.length === 10)
})

it('search', async () => {
const res = await search({ query: 'UDM2' })
assert(1)
})
})

0 comments on commit 8aa2d7f

Please sign in to comment.