-
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
ff9ebb9
commit 93ec767
Showing
15 changed files
with
323 additions
and
37 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
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
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ module.exports = { | |
type: 'get', | ||
params: [], | ||
category: "hidden", | ||
|
||
async execute(req, res) { | ||
|
||
} | ||
|
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
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,66 @@ | ||
const { describe, it } = require('node:test'); | ||
const assert = require('node:assert'); | ||
const api = require('../apis/base64.js'); | ||
|
||
describe('Base64 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 error on missing text', async () => { | ||
let req = {query:{type:'encode'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should error on missing type', async () => { | ||
let req = {query:{text:'hello'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should error on invalid type', async () => { | ||
let req = {query:{type:'fjda',text:'hello'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should encode hello to aGVsbG8=', 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, 'aGVsbG8='); | ||
}); | ||
it('should decode aGVsbG8= to hello', async () => { | ||
let req = {query:{type:'decode',text:'aGVsbG8='}}; | ||
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, 'hello'); | ||
}); | ||
}); |
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,78 @@ | ||
const { describe, it } = require('node:test'); | ||
const assert = require('node:assert'); | ||
const api = require('../apis/binary.js'); | ||
|
||
describe('Binary 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 error on missing text', async () => { | ||
let req = {query:{type:'encode'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should error on missing type', async () => { | ||
let req = {query:{text:'hello'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should error on invalid type', async () => { | ||
let req = {query:{type:'fjda',text:'hello'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should encode hello to 0110100001100101011011000110110001101111', 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, '0110100001100101011011000110110001101111'); | ||
}); | ||
it('should decode 0110100001100101011011000110110001101111 to hello', async () => { | ||
let req = {query:{type:'decode',text:'0110100001100101011011000110110001101111'}}; | ||
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, 'hello'); | ||
}); | ||
it('should decode 7_11010001100101110110011011001101111 to hello', async () => { | ||
let req = {query:{type:'decode',text:'7_11010001100101110110011011001101111'}}; | ||
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, 'hello'); | ||
}); | ||
}); |
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,66 @@ | ||
const { describe, it } = require('node:test'); | ||
const assert = require('node:assert'); | ||
const api = require('../apis/hex.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 error on missing text', async () => { | ||
let req = {query:{type:'encode'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should error on missing type', async () => { | ||
let req = {query:{text:'hello'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should error on invalid type', async () => { | ||
let req = {query:{type:'fjda',text:'hello'}}; | ||
let errored = false; | ||
let res = { | ||
error: function(){errored=true} | ||
}; | ||
api.execute(req,res); | ||
assert.strictEqual(errored, true); | ||
}); | ||
it('should encode hello to 68656c6c6f', 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, '68656c6c6f'); | ||
}); | ||
it('should decode 68656c6c6f to hello', async () => { | ||
let req = {query:{type:'decode',text:'68656c6c6f'}}; | ||
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, 'hello'); | ||
}); | ||
}); |
Oops, something went wrong.