mirror of
https://github.com/Karaka-Management/Build.git
synced 2026-01-10 19:28:41 +00:00
fix tests
This commit is contained in:
parent
d7c2cfb41c
commit
b51f71faf9
10
Config/jasmine.json
Normal file
10
Config/jasmine.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"spec_dir": "tests",
|
||||
"spec_files": [
|
||||
"**/*[sS]pec.js"
|
||||
],
|
||||
"helpers": [
|
||||
],
|
||||
"stopSpecOnExpectationFailure": false,
|
||||
"random": true
|
||||
}
|
||||
13
Config/jasmine_build.sh
Normal file
13
Config/jasmine_build.sh
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
#!/bin/bash
|
||||
|
||||
SEARCH_DIR="./tests"
|
||||
|
||||
FILES=$(find $SEARCH_DIR -type f -name "*Test.js")
|
||||
|
||||
for FILE in $FILES; do
|
||||
INPUT_PATH="$FILE"
|
||||
|
||||
OUT_PATH="${INPUT_PATH/Test.js/Spec.js}"
|
||||
|
||||
npx esbuild $INPUT_PATH --bundle --outfile=$OUT_PATH
|
||||
done
|
||||
|
|
@ -1,251 +0,0 @@
|
|||
{
|
||||
"Api Controller": {
|
||||
"scope": "php,tpl.php",
|
||||
"prefix": "apicontroller",
|
||||
"body": [
|
||||
"/**",
|
||||
" * Karaka",
|
||||
" *",
|
||||
" * PHP Version 8.1",
|
||||
" *",
|
||||
" * @package Modules\\\\$1",
|
||||
" * @copyright Dennis Eichhorn",
|
||||
" * @license OMS License 1.0",
|
||||
" * @version 1.0.0",
|
||||
" * @link https://jingga.app",
|
||||
" */",
|
||||
"declare(strict_types=1);",
|
||||
"",
|
||||
"namespace Modules\\\\$1\\Controller;",
|
||||
"",
|
||||
"use phpOMS\\Account\\Account;",
|
||||
"use phpOMS\\Localization\\ISO639x1Enum;",
|
||||
"use phpOMS\\Message\\NotificationLevel;",
|
||||
"use phpOMS\\Message\\RequestAbstract;",
|
||||
"use phpOMS\\Message\\ResponseAbstract;",
|
||||
"use phpOMS\\Model\\Message\\FormValidation;",
|
||||
"use phpOMS\\Utils\\Parser\\Markdown\\Markdown;",
|
||||
"",
|
||||
"/**",
|
||||
" * $1 controller class.",
|
||||
" *",
|
||||
" * @package Modules\\\\$1",
|
||||
" * @license OMS License 1.0",
|
||||
" * @link https://jingga.app",
|
||||
" * @since 1.0.0",
|
||||
" */",
|
||||
"final class ApiController extends Controller",
|
||||
"{",
|
||||
"",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Create a api controller"
|
||||
},
|
||||
"Null Model": {
|
||||
"scope": "php,tpl.php",
|
||||
"prefix": "nullmodel",
|
||||
"body": [
|
||||
"/**",
|
||||
" * Karaka",
|
||||
" *",
|
||||
" * PHP Version 8.1",
|
||||
" *",
|
||||
" * @package Modules\\\\$1",
|
||||
" * @copyright Dennis Eichhorn",
|
||||
" * @license OMS License 1.0",
|
||||
" * @version 1.0.0",
|
||||
" * @link https://jingga.app",
|
||||
" */",
|
||||
"declare(strict_types=1);",
|
||||
"",
|
||||
"namespace Modules\\\\$1\\Models;",
|
||||
"",
|
||||
"/**",
|
||||
" * Null model",
|
||||
" *",
|
||||
" * @package Modules\\\\$1",
|
||||
" * @license OMS License 1.0",
|
||||
" * @link https://jingga.app",
|
||||
" * @since 1.0.0",
|
||||
" */",
|
||||
"class Null$2 extends $2",
|
||||
"{",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Create a Null Model"
|
||||
},
|
||||
"Model": {
|
||||
"scope": "php,tpl.php",
|
||||
"prefix": "model",
|
||||
"body": [
|
||||
"/**",
|
||||
" * Karaka",
|
||||
" *",
|
||||
" * PHP Version 8.1",
|
||||
" *",
|
||||
" * @package Modules\\\\$1",
|
||||
" * @copyright Dennis Eichhorn",
|
||||
" * @license OMS License 1.0",
|
||||
" * @version 1.0.0",
|
||||
" * @link https://jingga.app",
|
||||
" */",
|
||||
"declare(strict_types=1);",
|
||||
"",
|
||||
"namespace Modules\\\\$1\\Models;",
|
||||
"",
|
||||
"/**",
|
||||
" * Null model",
|
||||
" *",
|
||||
" * @package Modules\\\\$1",
|
||||
" * @license OMS License 1.0",
|
||||
" * @link https://jingga.app",
|
||||
" * @since 1.0.0",
|
||||
" */",
|
||||
"class $2 implements \\JsonSerializable",
|
||||
"{",
|
||||
" private \\$id = 0;",
|
||||
"",
|
||||
" public function getId() : int",
|
||||
" {",
|
||||
" return \\$this->id;",
|
||||
" }",
|
||||
"",
|
||||
" /**",
|
||||
" * {@inheritdoc}",
|
||||
" */",
|
||||
" public function toArray() : array",
|
||||
" {",
|
||||
" return [",
|
||||
" 'id' => \\$this->id,",
|
||||
" ];",
|
||||
" }",
|
||||
"",
|
||||
" /**",
|
||||
" * {@inheritdoc}",
|
||||
" */",
|
||||
" public function __toString()",
|
||||
" {",
|
||||
" return (string) \\json_encode(\\$this->toArray());",
|
||||
" }",
|
||||
"",
|
||||
" /**",
|
||||
" * {@inheritdoc}",
|
||||
" */",
|
||||
" public function jsonSerialize()",
|
||||
" {",
|
||||
" eturn \\$this->toArray();",
|
||||
" }",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Create a Model"
|
||||
},
|
||||
"Api Create": {
|
||||
"scope": "php,tpl.php",
|
||||
"prefix": "apicreate",
|
||||
"body": [
|
||||
" /**",
|
||||
" * Api method to create a $1",
|
||||
" *",
|
||||
" * @param RequestAbstract \\$request Request",
|
||||
" * @param ResponseAbstract \\$response Response",
|
||||
" * @param mixed \\$data Generic data",
|
||||
" *",
|
||||
" * @return void",
|
||||
" *",
|
||||
" * @api",
|
||||
" *",
|
||||
" * @since 1.0.0",
|
||||
" */",
|
||||
" public function api$2Create(RequestAbstract \\$request, ResponseAbstract \\$response, \\$data = null) : void",
|
||||
" {",
|
||||
" if (!empty(\\$val = \\$this->validate$2Create(\\$request))) {",
|
||||
" \\$response->set('$1_create', new FormValidation(\\$val));",
|
||||
"",
|
||||
" return;",
|
||||
" }",
|
||||
"",
|
||||
" $$1 = \\$this->create$2FromRequest(\\$request);",
|
||||
" \\$this->createModel(\\$request->header->account, $$1, $2Mapper::class, '$1');",
|
||||
" \\$this->fillJsonResponse(\\$request, \\$response, NotificationLevel::OK, '$2', '$2 successfully created', $$1);",
|
||||
" }",
|
||||
"",
|
||||
" /**",
|
||||
" * Validate $1 from account create request",
|
||||
" *",
|
||||
" * @param RequestAbstract \\$request Request",
|
||||
" *",
|
||||
" * @return array<string, bool>",
|
||||
" *",
|
||||
" * @since 1.0.0",
|
||||
" */",
|
||||
" private function validate$2Create(RequestAbstract \\$request) : array",
|
||||
" {",
|
||||
" $val = [];",
|
||||
" if ((\\$val['account'] = empty(\\$request->getData('account')))",
|
||||
" ) {",
|
||||
" return $val;",
|
||||
" }",
|
||||
"",
|
||||
" return [];",
|
||||
" }",
|
||||
"",
|
||||
" /**",
|
||||
" * Method to create $1 from request.",
|
||||
" *",
|
||||
" * @param RequestAbstract \\$request Request",
|
||||
" *",
|
||||
" * @return $2",
|
||||
" *",
|
||||
" * @since 1.0.0",
|
||||
" */",
|
||||
" private function create$2FromRequest(RequestAbstract \\$request) : $2",
|
||||
" {",
|
||||
" $$1 = new $2();",
|
||||
"",
|
||||
" return $$1;",
|
||||
" }",
|
||||
""
|
||||
],
|
||||
"description": "Create a model in the api controller"
|
||||
},
|
||||
"Enum Create": {
|
||||
"scope": "php",
|
||||
"prefix": "enum",
|
||||
"body": [
|
||||
"/**",
|
||||
" * Karaka",
|
||||
" *",
|
||||
" * PHP Version 8.1",
|
||||
" *",
|
||||
" * @package Modules\\\\$1",
|
||||
" * @copyright Dennis Eichhorn",
|
||||
" * @license OMS License 1.0",
|
||||
" * @version 1.0.0",
|
||||
" * @link https://jingga.app",
|
||||
" */",
|
||||
"declare(strict_types=1);",
|
||||
"",
|
||||
"namespace Modules\\\\$1\\Models;",
|
||||
"",
|
||||
"use phpOMS\\Stdlib\\Base\\Enum;",
|
||||
"",
|
||||
"/**",
|
||||
" * $2 enum.",
|
||||
" *",
|
||||
" * @package Modules\\\\$1",
|
||||
" * @license OMS License 1.0",
|
||||
" * @link https://jingga.app",
|
||||
" * @since 1.0.0",
|
||||
" */",
|
||||
"abstract class $2 extends Enum",
|
||||
"{",
|
||||
" public const OPEN = 1;",
|
||||
"}",
|
||||
""
|
||||
],
|
||||
"description": "Create an enum"
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user