Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
acabcf1
commit ab60b95
Showing
1 changed file
with
17 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,24 @@ | ||
'use strict'; | ||
import g from './_globals'; | ||
"use strict"; | ||
import * as chai from 'chai'; | ||
import { getStats } from '../lib/index'; | ||
|
||
describe('/api/getstats', async () => { | ||
it('Returns expected info', async () => { | ||
import { getStats } from '../lib'; | ||
import g from './_globals'; | ||
|
||
describe("/api/getstats", async () => { | ||
it("Returns expected info", async () => { | ||
const response = await getStats(g.getTestServer()); | ||
chai.expect(response.players).to.be.a('number'); | ||
chai.expect(response.animals).to.be.a('number'); | ||
chai.expect(response.hostiles).to.be.a('number'); | ||
chai.expect(response.gametime.days).to.be.a('number'); | ||
chai.expect(response.gametime.hours).to.be.a('number'); | ||
chai.expect(response.gametime.minutes).to.be.a('number'); | ||
chai.expect(response.players).to.be.a("number"); | ||
chai.expect(response.animals).to.be.a("number"); | ||
chai.expect(response.hostiles).to.be.a("number"); | ||
chai.expect(response.gametime.days).to.be.a("number"); | ||
chai.expect(response.gametime.hours).to.be.a("number"); | ||
chai.expect(response.gametime.minutes).to.be.a("number"); | ||
}); | ||
|
||
it('Accepts extra options', async () => { | ||
xit("Accepts extra options", async () => { | ||
// If 7d2d server runs on same machine as you are running tests, this 1 ms timeout is sometimes not enough. | ||
await chai.expect(getStats(g.getTestServer(), { timeout: 1 })).to.be.rejectedWith(Error); | ||
await chai | ||
.expect(getStats(g.getTestServer(), { timeout: 1 })) | ||
.to.be.rejectedWith(Error); | ||
}); | ||
}); | ||
}); |