feat: codegen script to generate actix web tests
This commit is contained in:
parent
753863052a
commit
5352fcccfc
1 changed files with 28 additions and 0 deletions
28
utils/web_handler_test_generator.sh
Executable file
28
utils/web_handler_test_generator.sh
Executable file
|
@ -0,0 +1,28 @@
|
|||
#!/bin/bash
|
||||
|
||||
help() {
|
||||
echo "Usage: web_test_generator.sh <domain name> <handler route>"
|
||||
}
|
||||
|
||||
|
||||
run() {
|
||||
echo "
|
||||
#[actix_rt::test]
|
||||
async fn $1_web_$2_ui_works() {
|
||||
let routes = RoutesRepository::default();
|
||||
page_test_runner( &routes.$2).await;
|
||||
}"
|
||||
}
|
||||
|
||||
|
||||
|
||||
if [ -z $1 ]
|
||||
then
|
||||
help
|
||||
elif [ -z $2 ]
|
||||
then
|
||||
help
|
||||
else
|
||||
run $1 $2 | wl-copy
|
||||
run $1 $2
|
||||
fi
|
Loading…
Reference in a new issue