-
Notifications
You must be signed in to change notification settings - Fork 1
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
93ec767
commit caca4cd
Showing
4 changed files
with
30 additions
and
3 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
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
const { describe, it } = require('node:test'); | ||
const assert = require('node:assert'); | ||
const api = require('../apis/reverse.js'); | ||
|
||
describe('Hex api', () => { | ||
it('should error on empty', async () => { | ||
let req = {query:{}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should transform hello to olleh', async () => { | ||
let req = {query:{type:'encode',text:'hello'}}; | ||
let errored = false; | ||
let json = null; | ||
let res = { | ||
error: function(){errored=true}, | ||
json: function(j){json=j} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, false); | ||
assert.strictEqual(json.text, 'olleh'); | ||
}); | ||
}); |
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
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