Replace parsing and test libraries

* WIP

* WIP

* wip

* WIP

* Several fixes

* Tests wip port to playwright

* WIP

* Fix more tests

* Serialization tests fixed

* Several fixes for tests

* Input options types

* Type adjustments

* Fix object reference parser

* Tests fixes

* More tests fixes
This commit is contained in:
barsdeveloper
2024-02-14 00:40:42 +01:00
committed by GitHub
parent 90584e16c0
commit 7469d55518
126 changed files with 7443 additions and 6253 deletions

View File

@@ -3,16 +3,16 @@ import IEntity from "../entity/IEntity.js"
import SerializerFactory from "./SerializerFactory.js"
import Utility from "../Utility.js"
/** @template {SimpleValueType<SimpleValue>} T */
/** @template {AttributeConstructor<Attribute>} T */
export default class Serializer {
/** @type {(v: String) => String} */
static same = v => v
/** @type {(entity: SimpleValue, serialized: String) => String} */
/** @type {(entity: Attribute, serialized: String) => String} */
static notWrapped = (entity, serialized) => serialized
/** @type {(entity: SimpleValue, serialized: String) => String} */
/** @type {(entity: Attribute, serialized: String) => String} */
static bracketsWrapped = (entity, serialized) => `(${serialized})`
/** @param {T} entityType */
@@ -43,7 +43,6 @@ export default class Serializer {
/** @param {ConstructedType<T>} value */
write(value, insideString = false) {
// @ts-expect-error
return this.doWrite(value, insideString)
}
@@ -53,7 +52,7 @@ export default class Serializer {
*/
doRead(value) {
let grammar = Grammar.grammarFor(undefined, this.entityType)
const parseResult = grammar.parse(value)
const parseResult = grammar.run(value)
if (!parseResult.status) {
throw new Error(`Error when trying to parse the entity ${this.entityType.prototype.constructor.name}.`)
}
@@ -61,7 +60,7 @@ export default class Serializer {
}
/**
* @param {ConstructedType<T> & IEntity} entity
* @param {ConstructedType<T>} entity
* @param {Boolean} insideString
* @returns {String}
*/