-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathtest.js
53 lines (43 loc) · 1.14 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
"use strict";
const noswears = require("./index");
const expected = "**** brain**** is a weird *****";
noswears.filterSwearWords(badString, (goodString) => {
let expected = "**** brain**** is a weird *****";
console.log(
`Testing filterSwearWords
Want string "${expected}", got "${goodString}"`,
);
if (goodString === expected) {
console.log("✔ Success!");
} else {
console.log("✖ Failed!");
}
});
var filterSyncResult = noswears.filterSync(badString);
console.log('Testing filter\nWant string "' + expected + '", got', expected);
if (filterSyncResult === expected) {
console.log("✔ Success!\n");
} else {
console.log("✖ Failed!\n");
}
noswears.hasSwears(badString, (swearBool) => {
console.log(
`Testing hasSwears
Want true, got ${swearBool}`,
);
if (swearBool === true) {
console.log("✔ Success!");
} else {
console.log("✖ Failed!");
}
});
let hasSwearsSyncResult = noswears.hasSwearsSync(badString);
console.log(
`Testing hasSwearsSync
Want true, got ${hasSwearsSyncResult}`,
);
if (hasSwearsSyncResult) {
console.log("✔ Success!");
} else {
console.log("✖ Failed!");
}