Skip to content

Commit

Permalink
Add a test for when the request to the server errors
Browse files Browse the repository at this point in the history
  • Loading branch information
niekcandaele committed Jul 4, 2020
1 parent 081ec3b commit 24336a7
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/unit/helpers/sdtd/validate-item-name.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,12 @@ describe('HELPER sdtd/validate-item-name', () => {
Object.assign(fakeServer, sails.testServer)

fakeServer.id += 5
await expect(sails.helpers.sdtd.validateItemName(fakeServer, "ammo9mmBulletBall")).to.eventually.be.rejectedWith(Error)
await expect(sails.helpers.sdtd.validateItemName(fakeServer.id, "ammo9mmBulletBall")).to.eventually.be.rejectedWith(Error)
});

it('Throws when a request to the server fails', async () => {
sails.helpers.sdtdApi.executeConsoleCommand = sandbox.stub().throws(Error)
await expect(sails.helpers.sdtd.validateItemName(sails.testServer.id, "ammo9mmBulletBall")).to.eventually.be.rejectedWith(Error)
});
});

Expand Down

0 comments on commit 24336a7

Please sign in to comment.