mirror of https://gitgud.io/fatchan/jschan.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
844 B
30 lines
844 B
2 years ago
|
const { getSecureTrip, getInsecureTrip } = require('./tripcode.js');
|
||
|
|
||
|
describe('getSecureTrip() - "secure" tripcodes', () => {
|
||
|
const cases = [
|
||
|
{ in: '' },
|
||
|
{ in: null },
|
||
|
{ in: '13245' },
|
||
|
{ in: '1324512345123451234512345123451234512345' },
|
||
|
];
|
||
|
for(let i in cases) {
|
||
|
test(`should not error for an input of ${cases[i].in}`, async () => {
|
||
|
expect((await getSecureTrip(cases[i].in)));
|
||
|
});
|
||
|
}
|
||
|
});
|
||
|
|
||
|
describe('getInsecureTrip() - "insecure" tripcodes', () => {
|
||
|
const cases = [
|
||
|
{ in: '', out: "8NBuQ4l6uQ" },
|
||
|
{ in: null, out: "8NBuQ4l6uQ" },
|
||
|
{ in: '13245', out: "VPkdFNhOGY" },
|
||
|
{ in: '1324512345123451234512345123451234512345', out: "9ovLU2O1wk" },
|
||
|
];
|
||
|
for(let i in cases) {
|
||
|
test(`should contain ${cases[i].out} for an input of ${cases[i].in}`, () => {
|
||
|
expect(getInsecureTrip(cases[i].in)).toBe(cases[i].out);
|
||
|
});
|
||
|
}
|
||
|
});
|