test(bot): test the LITERAL filter
All checks were successful
Build & Push Docker Image / build (push) Successful in 22s
Test & Build / build (push) Successful in 30s

This commit is contained in:
Corban-Lee Jones 2025-05-22 11:23:22 +01:00
parent e1709d8b06
commit 2101e30b8c

View File

@ -118,7 +118,52 @@ describe("Match: ANY", () => {
runFilterTest(filter, testCases);
});
describe("Match: LITERAL", () => { });
describe("Match: LITERAL", () => {
const filter: prisma.Filter = {
...templateFilter,
name: "Block Weekly Pop Quiz",
value: String.raw`Pop Quiz`,
matching_algorithm: MatchingAlgorithms.EXACT,
is_insensitive: false
};
const testCases: FilterTestCase[] = [
{
input: "Pop Quiz 01: Win potential prizes in our first weekly pop quiz!",
expected: true
},
{
input: "The price of petrol has fallen for the first time in 5 years.",
expected: false
},
{
input: "The President's expected to deliver a speech for the easter holidays",
expected: false
},
{
input: "Pop Quiz: in todays quiz, the prizes include $1000 USD!",
expected: true
},
{
input: "The number of pop quizes at our disposoal is near infinite.",
expected: false
},
{
input: "Pop Quiz!",
expected: true
},
{
input: "There will be no Pop Quiz this week.",
expected: true
},
{
input: "There will be a pop quiz this week",
expected: false // case sensitive
}
];
runFilterTest(filter, testCases);
});
describe("Match: REGEX", () => {
const filter: prisma.Filter = {