@ -231,7 +231,7 @@ testing 123`
} ) ;
let filterId ;
test ( 'add filter post ' , async ( ) => {
test ( 'add filter to test board ' , async ( ) => {
const params = new URLSearchParams ( {
_csrf : csrfToken ,
filters : ` notgood
@ -252,25 +252,24 @@ bad words`,
redirect : 'manual' ,
} ) ;
expect ( response . ok ) . toBe ( true ) ;
const filterPage = await fetch ( 'http://localhost/test/manage/filter.html' , {
const filterPage = await fetch ( 'http://localhost/test/manage/filters .html' , {
headers : {
'cookie' : sessionCookie ,
} ,
} ) . then ( res => res . text ( ) ) ;
const checkIndex = filterPage . indexOf ( 'name="checkedfilter" value="' ) ;
filterId = filterPage . substring ( checkIndex + 28 , checkIndex + 28 + 24 ) ;
const checkIndex = filterPage . indexOf ( 'name="checkedfilters " value="' ) ;
filterId = filterPage . substring ( checkIndex + 29 , checkIndex + 29 + 24 ) ;
} ) ;
test ( 'edit filter p ost' , async ( ) => {
test ( 'edit filter on te st board ' , async ( ) => {
const params = new URLSearchParams ( {
_csrf : csrfToken ,
board : test ,
filter _id : filterId ,
filters : 'edited filters' ,
strict _filtering : 'true' ,
filter _mode : '0 ' ,
filter _mode : '1 ' ,
filter _message : 'edited message' ,
filter _ban _duration : '0 '
filter _ban _duration : '1s '
// filter_ban_appealable omitted to change to false
} ) ;
const response = await fetch ( 'http://localhost/forms/board/test/editfilter' , {
@ -283,7 +282,7 @@ bad words`,
redirect : 'manual' ,
} ) ;
expect ( response . ok ) . toBe ( true ) ;
const filterPage = await fetch ( 'http://localhost/test/manage/filter.html' , {
const filterPage = await fetch ( 'http://localhost/test/manage/filters .html' , {
headers : {
'cookie' : sessionCookie ,
} ,
@ -292,10 +291,39 @@ bad words`,
expect ( editTextIndex ) . not . toBe ( - 1 ) ;
} ) ;
test ( 'delete filter post' , async ( ) => {
test ( 'make a post that doesnt hit board filter' , async ( ) => {
const params = new URLSearchParams ( ) ;
params . append ( 'message' , 'blahblahblah' ) ;
params . append ( 'captcha' , '000000' ) ;
const response = await fetch ( 'http://localhost/forms/board/test/post' , {
headers : {
'x-using-xhr' : 'true' ,
} ,
method : 'POST' ,
body : params
} ) ;
expect ( response . ok ) . toBe ( true ) ;
} ) ;
test ( 'make a post that hits board filter' , async ( ) => {
const params = new URLSearchParams ( ) ;
params . append ( 'message' , 'edited filters' ) ;
params . append ( 'captcha' , '000000' ) ;
const response = await fetch ( 'http://localhost/forms/board/test/post' , {
headers : {
'x-using-xhr' : 'true' ,
} ,
method : 'POST' ,
body : params
} ) ;
expect ( response . ok ) . not . toBe ( true ) ;
await new Promise ( res => setTimeout ( res , 10000 ) ) ; //let ban expire
} ) ;
test ( 'delete test board filter' , async ( ) => {
const params = new URLSearchParams ( {
_csrf : csrfToken ,
checkedfilter : filterId ,
checkedfilters : filterId ,
} ) ;
const response = await fetch ( 'http://localhost/forms/board/test/deletefilter' , {
headers : {
@ -309,6 +337,20 @@ bad words`,
expect ( response . ok ) . toBe ( true ) ;
} ) ;
test ( 'make a post that passes the deleted filter' , async ( ) => {
const params = new URLSearchParams ( ) ;
params . append ( 'message' , 'editing filter' ) ;
params . append ( 'captcha' , '000000' ) ;
const response = await fetch ( 'http://localhost/forms/board/test/post' , {
headers : {
'x-using-xhr' : 'true' ,
} ,
method : 'POST' ,
body : params
} ) ;
expect ( response . ok ) . toBe ( true ) ;
} ) ;
test ( 'add staff' , async ( ) => {
const params = new URLSearchParams ( {
_csrf : csrfToken ,