newStaffLDB-API #48
@ -1,5 +1,7 @@
|
|||||||
import { getDomainFromEmail } from "../../src/utils/sanitizer.utils";
|
import { getDomainFromEmail } from "../../src/utils/sanitizer.utils";
|
||||||
import { removeNonNumeric } from "../../src/utils/sanitizer.utils";
|
import { removeNonNumeric } from "../../src/utils/sanitizer.utils";
|
||||||
|
import { removeNonAlpha } from "../../src/utils/sanitizer.utils";
|
||||||
|
import { removeNonAlphanumeric } from "../../src/utils/sanitizer.utils";
|
||||||
|
|
||||||
describe("Sanitize Email", () => {
|
describe("Sanitize Email", () => {
|
||||||
const inputs = [
|
const inputs = [
|
||||||
@ -30,3 +32,27 @@ describe("Remove non-numeric", () => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("Remove non-Alpha", () => {
|
||||||
|
const inputs = ["DROP/*comment*/sampletable", "10; DROP TABLE members /*"];
|
||||||
|
const outputs = ["DROPcommentsampletable", "DROPTABLEmembers"];
|
||||||
|
for (const key in inputs) {
|
||||||
|
const input = inputs[key];
|
||||||
|
const desired = outputs[key];
|
||||||
|
test(`Should return with only letters: ${key}`, () => {
|
||||||
|
expect(removeNonAlpha(input)).toEqual(desired);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
describe("Remove non-alphanumeric", () => {
|
||||||
|
const inputs = ["DROP/*comment*/sampletable", "10; DROP TABLE members /*", "1F44"];
|
||||||
|
const outputs = ["DROPcommentsampletable", "10DROPTABLEmembers", "1F44"];
|
||||||
|
for (const key in inputs) {
|
||||||
|
const input = inputs[key];
|
||||||
|
const desired = outputs[key];
|
||||||
|
test(`Should return with only alphanumeric: ${key}`, () => {
|
||||||
|
expect(removeNonAlphanumeric(input)).toEqual(desired);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
})
|
Loading…
Reference in New Issue
Block a user