6 waf = Waf.getInstance()
7})
8
9describe(`WAF`, () => {10 it('should detect malicious string', () => {
11 expect(waf.test('select column from database', [])).toEqual('116')
12 })
6 ratelimiter = RateLimiter.getInstance()
7})
8
9describe(`Ratelimiter`, () => {10 it('should increase request count by 1 every time', async () => {
11 const result = await ratelimiter.process('test_ip', {
12 requests: 0,
9 solver = new Solver()
10})
11
12describe(`PoW service`, () => {13 let powData: any // skipcq: JS-0309, JS-0323
14 it('should be able to generate problems', () => {
15 powData = pow.getProblem()
7 return
8})
9
10describe(`NoSql`, () => {11 it('should be settable', async () => {
12 expect(await nosql.setNX('test', '0')).toStrictEqual('OK')
13 })
6 blacklist = Blacklist.getInstance()
7})
8
9describe(`Blacklist`, () => {10 it('should pass ban list checking normally', async () => {
11 expect(await blacklist.check('test_ip')).toBeTruthy()
12 })
Template literals are useful when you need:
Strings that have unescaped double quotes and single quotes.
Strings that need line breaks in them.
If neither of these three conditions is met, you can replace the template expression with a regular string literal.
const dialogue = `"Journey before destination", said Dalinar.`
const dialogue2 = `What is a 'Kwisatz Haderach'?`
const dialogue = '"Journey before destination", said Dalinar.'
const dialogue2 = "What is a 'Kwisatz Haderach'?"
const dialogue3 = `"${getLine()}", said ${getChararcter()}`