More tests and fixed

This commit is contained in:
barsdeveloper
2024-06-03 12:42:42 +02:00
parent 8fed17b20f
commit 1a8636bb5d
18 changed files with 484 additions and 433 deletions

View File

@@ -1,5 +1,6 @@
import { expect, test } from "@playwright/test"
import Utility from "../js/Utility.js"
import AlternativesEntity from "../js/entity/AlternativesEntity.js"
import ArrayEntity from "../js/entity/ArrayEntity.js"
import BooleanEntity from "../js/entity/BooleanEntity.js"
import FormatTextEntity from "../js/entity/FormatTextEntity.js"
@@ -7,6 +8,8 @@ import GuidEntity from "../js/entity/GuidEntity.js"
import IntegerEntity from "../js/entity/IntegerEntity.js"
import KeyBindingEntity from "../js/entity/KeyBindingEntity.js"
import LinearColorEntity from "../js/entity/LinearColorEntity.js"
import NaturalNumberEntity from "../js/entity/NaturalNumberEntity.js"
import NullEntity from "../js/entity/NullEntity.js"
import NumberEntity from "../js/entity/NumberEntity.js"
import ObjectReferenceEntity from "../js/entity/ObjectReferenceEntity.js"
import PinEntity from "../js/entity/PinEntity.js"
@@ -22,9 +25,8 @@ import VectorEntity from "../js/entity/VectorEntity.js"
import Grammar from "../js/serialization/Grammar.js"
import SerializerFactory from "../js/serialization/SerializerFactory.js"
import initializeSerializerFactory from "../js/serialization/initializeSerializerFactory.js"
import NaturalNumberEntity from "../js/entity/NaturalNumberEntity.js"
import NullEntity from "../js/entity/NullEntity.js"
import AlternativesEntity from "../js/entity/AlternativesEntity.js"
import IEntity from "../js/entity/IEntity.js"
import ColorChannelEntity from "../js/entity/ColorChannelEntity.js"
test.beforeAll(() => initializeSerializerFactory())
@@ -35,11 +37,11 @@ test("ArrayEntity", () => {
const grammar = ArrayEntity.grammar
let value = grammar.parse("()")
expect(value).toEqual(new ArrayEntity([]))
value = grammar.parse("( )")
expect(value.toString()).toEqual("()")
value = grammar.parse("( )")
expect(value).toEqual(new ArrayEntity([]))
expect(value.toString()).toEqual("()")
value = grammar.parse("(1, 2, 3, 4, 5, 6)")
expect(value.toString()).toEqual("(1,2,3,4,5,6)")
expect(value).toEqual(new ArrayEntity([
new NumberEntity(1),
new NumberEntity(2),
@@ -48,44 +50,46 @@ test("ArrayEntity", () => {
new NumberEntity(5),
new NumberEntity(6),
]))
expect(value.toString()).toEqual("(1,2,3,4,5,6)")
expect(value.Self().className()).toEqual("ArrayEntity")
value.values.map(v => v.Self().className()).forEach(v => expect(v).toEqual("NumberEntity"))
value = grammar.parse("(1, 2, )")
expect(value.toString()).toEqual("(1,2,)")
expect(value).toEqual(new ArrayEntity([
new NumberEntity(1),
new NumberEntity(2),
]))
expect(value.toString()).toEqual("(1,2,)")
expect(grammar.parse("( - )")).toThrow("Could not parse")
}
{
const grammar = ArrayEntity.of(NumberEntity).grammar
let value = grammar.parse("(2,4,6,8)")
expect(value.toString()).toEqual("(2,4,6,8)")
expect(value).toEqual(new ArrayEntity([
new NumberEntity(2),
new NumberEntity(4),
new NumberEntity(6),
new NumberEntity(8),
]))
expect(value.toString()).toEqual("(2,4,6,8)")
}
{
const grammar = ArrayEntity.of(IntegerEntity).grammar
let value = grammar.parse("(-0, -1, -2)")
expect(value.toString()).toEqual("(0,-1,-2)")
expect(value).toEqual(new ArrayEntity([
new IntegerEntity(0),
new IntegerEntity(-1),
new IntegerEntity(-2),
]))
expect(value.toString()).toEqual("(0,-1,-2)")
value.values.map(v => v.Self().className()).forEach(v => expect(v).toEqual("IntegerEntity"))
value = grammar.parse("(-0, -1, -2,)")
expect(value.toString()).toEqual("(0,-1,-2,)")
expect(value).toEqual(new ArrayEntity([
new IntegerEntity(0),
new IntegerEntity(-1),
new IntegerEntity(-2),
]))
expect(() => grammar.parse("(-1, -2.1, -3)")).toThrowError()
expect(value.toString()).toEqual("(0,-1,-2,)")
expect(() => grammar.parse("(-1, -2.1, -3)")).toThrow("Could not parse")
}
{
const grammar = ArrayEntity.grammar
@@ -96,7 +100,6 @@ test("ArrayEntity", () => {
3BEF2168446CAA32D5B54289FAB2F0BA,
Some(a=1, b="number:\\"2\\"")
)`)
expect(value.toString()).toEqual('("alpha","beta",123,3BEF2168446CAA32D5B54289FAB2F0BA,Some(a=1,b="number:\\"2\\""))')
expect(value).toEqual(new ArrayEntity([
new StringEntity("alpha"),
new StringEntity("beta"),
@@ -107,6 +110,7 @@ test("ArrayEntity", () => {
b: new StringEntity('number:"2"'),
})
]))
expect(value.toString()).toEqual('("alpha","beta",123,3BEF2168446CAA32D5B54289FAB2F0BA,Some(a=1,b="number:\\"2\\""))')
expect(value.values.map(v => v.Self().className())).toEqual([
"StringEntity",
"StringEntity",
@@ -118,7 +122,6 @@ test("ArrayEntity", () => {
A(first = (9,8,7,6,5), second = 00000000000000000000000000000000),
B(key="hello"),
)`)
expect(value.toString()).toEqual('(A(first=(9,8,7,6,5),second=00000000000000000000000000000000),B(key="hello"),)')
expect(value).toEqual(new ArrayEntity([
new UnknownKeysEntity({
lookbehind: new StringEntity("A"),
@@ -136,6 +139,7 @@ test("ArrayEntity", () => {
key: new StringEntity("hello"),
})
]))
expect(value.toString()).toEqual('(A(first=(9,8,7,6,5),second=00000000000000000000000000000000),B(key="hello"),)')
}
{
// Nested
@@ -143,17 +147,16 @@ test("ArrayEntity", () => {
IntegerEntity,
ArrayEntity.of(IntegerEntity)
)).grammar.parse("((1, 2), (3, 4), 5)")
expect(value.toString()).toEqual("((1,2),(3,4),5)")
expect(value).toEqual(new ArrayEntity([
new ArrayEntity([new IntegerEntity(1), new IntegerEntity(2)]),
new ArrayEntity([new IntegerEntity(3), new IntegerEntity(4)]),
new IntegerEntity(5),
]))
expect(value.toString()).toEqual("((1,2),(3,4),5)")
}
{
const grammar = ArrayEntity.grammar
let value = grammar.parse('(((1, "2"), (3, 4)), "5")')
expect(value.toString()).toEqual('(((1,"2"),(3,4)),"5")')
expect(value).toEqual(new ArrayEntity([
new ArrayEntity([
new ArrayEntity([new NumberEntity(1), new StringEntity("2")]),
@@ -161,12 +164,12 @@ test("ArrayEntity", () => {
]),
new StringEntity("5")
]))
expect(value.toString()).toEqual('(((1,"2"),(3,4)),"5")')
}
{
let value = ArrayEntity.grammar.parse(`(
One(a = (1,(2,(3,(4)))), b = ()),
)`)
expect(value.toString()).toEqual("(One(a=(1,(2,(3,(4)))),b=()),)")
expect(value).toEqual(new ArrayEntity([
new UnknownKeysEntity({
lookbehind: "One",
@@ -185,24 +188,29 @@ test("ArrayEntity", () => {
b: new NullEntity(),
}),
]))
expect(value.toString()).toEqual("(One(a=(1,(2,(3,(4)))),b=()),)")
}
})
test("Boolean", () => {
let grammar = BooleanEntity.grammar
let value = grammar.parse("true")
expect(value).toEqual(new BooleanEntity(true))
expect(value).toBeInstanceOf(BooleanEntity)
expect(value.toString()).toEqual("True")
expect(value).toEqual(new BooleanEntity(true))
expect(value.toString()).toEqual("true")
value = grammar.parse("True")
expect(value).toBeInstanceOf(BooleanEntity)
expect(value).toEqual(new BooleanEntity(true))
expect(value.toString()).toEqual("True")
value = grammar.parse("false")
expect(value).toBeInstanceOf(BooleanEntity)
expect(value).toEqual(new BooleanEntity(false))
expect(value.toString()).toEqual("False")
expect(value.toString()).toEqual("false")
value = grammar.parse("False")
expect(value).toBeInstanceOf(BooleanEntity)
expect(value).toEqual(new BooleanEntity(false))
expect(value.toString()).toEqual("False")
expect(() => grammar.parse("truee")).toThrow("Could not parse")
})
test("FormatTextEntity", () => {
@@ -214,19 +222,20 @@ test("FormatTextEntity", () => {
.toEqual('LOCGEN_FORMAT_NAMED(NSLOCTEXT("KismetSchema", "SplitPinFriendlyNameFormat", "{PinDisplayName} {ProtoPinDisplayName}"), "PinDisplayName", "Out Hit", "ProtoPinDisplayName", "Blocking Hit")')
value = grammar.parse(String.raw`LOCGEN_FORMAT_ORDERED(
NSLOCTEXT(
"PCGSettings",
"OverridableParamPinTooltip",
"{0}Attribute type is \"{1}\" and its exact name is \"{2}\""
),
"If InRangeMin = InRangeMax, then that density value is mapped to the average of OutRangeMin and OutRangeMax\n",
"float",
"InRangeMin"
)`)
NSLOCTEXT(
"PCGSettings",
"OverridableParamPinTooltip",
"{0}Attribute type is \"{1}\" and its exact name is \"{2}\""
),
"If InRangeMin = InRangeMax, then that density value is mapped to the average of OutRangeMin and OutRangeMax\n",
"float",
"InRangeMin"
)`)
expect(value.print())
.toEqual(`If InRangeMin = InRangeMax, then that density value is mapped to the average of OutRangeMin and OutRangeMax\nAttribute type is "float" and its exact name is "InRangeMin"`)
expect(value.toString())
.toEqual(String.raw`LOCGEN_FORMAT_ORDERED(NSLOCTEXT("PCGSettings", "OverridableParamPinTooltip", "{0}Attribute type is \"{1}\" and its exact name is \"{2}\""), "If InRangeMin = InRangeMax, then that density value is mapped to the average of OutRangeMin and OutRangeMax\n", "float", "InRangeMin")`)
expect(() => grammar.parse("LOCGEN_FORMAT_NAMED")).toThrow("Could not parse")
})
test("GuidEntity", () => {
@@ -247,124 +256,171 @@ test("GuidEntity", () => {
expect(value).toEqual(new GuidEntity("6edC4a425ca948da8bC78bA52DED6C6C"))
expect(value.toString()).toEqual("6edC4a425ca948da8bC78bA52DED6C6C")
expect(() => grammar.parse("172087193 9B04362973544B3564FDB2C")).toThrow()
expect(() => grammar.parse("E25F14F8F3E9441AB07153E7DA2BA2B")).toThrow()
expect(() => grammar.parse("A78988B0097E48418C8CB87EC5A67ABF7")).toThrow()
expect(() => grammar.parse("172087193 9B04362973544B3564FDB2C")).toThrow("Could not parse")
expect(() => grammar.parse("E25F14F8F3E9441AB07153E7DA2BA2B")).toThrow("Could not parse")
expect(() => grammar.parse("A78988B0097E48418C8CB87EC5A67ABF7")).toThrow("Could not parse")
})
test("IntegerEntity", () => {
let grammar = IntegerEntity.grammar
let integer = grammar.parse("0")
expect(integer).toEqual(new IntegerEntity(0))
expect(integer).not.toEqual(new NaturalNumberEntity(0))
let value = grammar.parse("0")
expect(value).toEqual(new IntegerEntity(0))
expect(value).toBeInstanceOf(IntegerEntity)
integer = grammar.parse("+0")
expect(integer).toEqual(new IntegerEntity(0))
value = grammar.parse("+0")
expect(value).toEqual(new IntegerEntity(0))
expect(value).toBeInstanceOf(IntegerEntity)
integer = grammar.parse("-0")
expect(integer).toEqual(new IntegerEntity(0))
value = grammar.parse("-0")
expect(value).toEqual(new IntegerEntity(0))
expect(value).toBeInstanceOf(IntegerEntity)
integer = grammar.parse("99")
expect(integer).toEqual(new IntegerEntity(99))
value = grammar.parse("99")
expect(value).toEqual(new IntegerEntity(99))
expect(value).toBeInstanceOf(IntegerEntity)
integer = grammar.parse("-8685")
expect(integer).toEqual(new IntegerEntity(-8685))
value = grammar.parse("-8685")
expect(value).toEqual(new IntegerEntity(-8685))
expect(value).toBeInstanceOf(IntegerEntity)
integer = grammar.parse("+555")
expect(integer).toEqual(new IntegerEntity(555))
value = grammar.parse("+555")
expect(value).toEqual(new IntegerEntity(555))
expect(value).toBeInstanceOf(IntegerEntity)
integer = grammar.parse("1000000000")
expect(integer).toEqual(new IntegerEntity(1000000000))
value = grammar.parse("1000000000")
expect(value).toEqual(new IntegerEntity(1000000000))
expect(value).toBeInstanceOf(IntegerEntity)
expect(() => grammar.parse("1.2").value).toThrow()
})
test("KeyBindingEntity", () => {
let serializer = SerializerFactory.getSerializer(KeyBindingEntity)
let grammar = KeyBindingEntity.grammar
let binding = serializer.read("A")
expect(binding).toBeInstanceOf(KeyBindingEntity)
expect(binding).toMatchObject({ Key: { value: "A" } })
let value = grammar.parse("A")
expect(value).toEqual(new KeyBindingEntity({ Key: new SymbolEntity("A") }))
expect(value).toBeInstanceOf(KeyBindingEntity)
expect(value.toString()).toEqual("(Key=A)")
binding = serializer.read("(bCtrl=True,Key=A)")
expect(binding).toBeInstanceOf(KeyBindingEntity)
expect(binding).toMatchObject({ Key: { value: "A" }, bCtrl: true })
value = grammar.parse("(bCtrl=True,Key=A)")
expect(value).toEqual(new KeyBindingEntity({ bCtrl: new BooleanEntity(true), Key: new SymbolEntity("A") }))
expect(value).toBeInstanceOf(KeyBindingEntity)
expect(value.toString()).toEqual("(bCtrl=True,Key=A)")
binding = serializer.read("(bCtrl=false,bShift=false,bCmd=true,bAlt=false,Key=X)")
expect(binding).toBeInstanceOf(KeyBindingEntity)
expect(binding).toMatchObject({ Key: { value: "X" }, bAlt: false, bCtrl: false, bCmd: true })
value = grammar.parse("(bCtrl=false,bShift=false,bCmd=true,bAlt=false,Key=X)")
expect(value).toBeInstanceOf(KeyBindingEntity)
expect(value).toEqual(new KeyBindingEntity({
bCtrl: new BooleanEntity(false),
bShift: new BooleanEntity(false),
bCmd: new BooleanEntity(true),
bAlt: new BooleanEntity(false),
Key: new SymbolEntity("X"),
}))
expect(value.toString()).toEqual("(bCtrl=False,bShift=False,bCmd=True,bAlt=False,Key=X)")
binding = serializer.read("( bCtrl= false \n, Key \n\n\n =Y ,bAlt=true )")
expect(binding).toBeInstanceOf(KeyBindingEntity)
expect(binding).toMatchObject({ Key: { value: "Y" }, bAlt: true, bCtrl: false })
value = grammar.parse("( bCtrl= false \n, Key \n\n\n =Y ,bAlt=true )")
expect(value).toEqual(new KeyBindingEntity({
bCtrl: new BooleanEntity(false),
Key: new SymbolEntity("Y"),
bAlt: new BooleanEntity(true),
}))
expect(value).toBeInstanceOf(KeyBindingEntity)
})
test("LinearColorEntity", () => {
const serializer = SerializerFactory.getSerializer(LinearColorEntity)
const grammar = LinearColorEntity.grammar
let color = LinearColorEntity.getWhite()
expect(color.toRGBA()).toStrictEqual([255, 255, 255, 255])
expect(color.toRGBAString()).toStrictEqual("FFFFFFFF")
expect(color.toNumber()).toStrictEqual(-1)
expect(color.toHSVA()).toStrictEqual([0, 0, 1, 1])
let value = LinearColorEntity.getWhite()
expect(value).toEqual(new LinearColorEntity({
R: new ColorChannelEntity(1),
G: new ColorChannelEntity(1),
B: new ColorChannelEntity(1),
A: new ColorChannelEntity(1),
}))
expect(value.toRGBA()).toStrictEqual([255, 255, 255, 255])
expect(value.toRGBAString()).toStrictEqual("FFFFFFFF")
expect(value.toNumber()).toStrictEqual(-1)
expect(value.toHSVA()).toStrictEqual([0, 0, 1, 1])
expect(value.toString()).toStrictEqual("(R=1.000000,G=1.000000,B=1.000000,A=1.000000)")
color = serializer.read("(R=1,G=0,B=0)")
expect(color.toRGBA()).toStrictEqual([255, 0, 0, 255])
expect(color.toRGBAString()).toStrictEqual("FF0000FF")
expect(color.toNumber()).toStrictEqual(-16776961)
expect(color.toHSVA()).toStrictEqual([0, 1, 1, 1])
value = grammar.parse("(R=1,G=0,B=0)")
expect(value).toEqual(new LinearColorEntity({
R: new ColorChannelEntity(1),
G: new ColorChannelEntity(0),
B: new ColorChannelEntity(0),
A: new ColorChannelEntity(1),
}))
expect(value.toRGBA()).toStrictEqual([255, 0, 0, 255])
expect(value.toRGBAString()).toStrictEqual("FF0000FF")
expect(value.toNumber()).toStrictEqual(-16776961)
expect(value.toHSVA()).toStrictEqual([0, 1, 1, 1])
expect(value.toString()).toStrictEqual("(R=1.000000,G=0.000000,B=0.000000,A=1.000000)")
color = serializer.read("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)")
expect(color.toRGBA()).toStrictEqual([0, 168, 255, 255])
expect(color.toRGBAString()).toStrictEqual("00A8FFFF")
expect(color.toNumber()).toStrictEqual(11075583)
expect(color.toHSVA()).toStrictEqual([0.55666666666666666666, 1, 1, 1])
value = grammar.parse("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)")
expect(value).toEqual(new LinearColorEntity({
R: new ColorChannelEntity(0),
G: new ColorChannelEntity(0.66),
B: new ColorChannelEntity(1),
A: new ColorChannelEntity(1),
}))
expect(value.toRGBA()).toStrictEqual([0, 168, 255, 255])
expect(value.toRGBAString()).toStrictEqual("00A8FFFF")
expect(value.toNumber()).toStrictEqual(11075583)
expect(value.toHSVA()).toStrictEqual([0.55666666666666666666, 1, 1, 1])
expect(value.toString()).toStrictEqual("(R=0.000000,G=0.660000,B=1.000000,A=1.000000)")
color = serializer.read("(B=0.04394509003266556,G=0.026789300067696642,A=0.83663232408635,R=0.6884158028074934,)")
expect(color.toRGBA()).toStrictEqual([176, 7, 11, 213])
expect(color.toRGBAString()).toStrictEqual("B0070BD5")
expect(color.toNumber()).toStrictEqual(-1341715499)
expect(color.toHSVA().map(v => Utility.roundDecimals(v, 3))).toStrictEqual([0.996, 0.961, 0.688, 0.837])
value = grammar.parse("(B=0.04394509003266556,G=0.026789300067696642,A=0.83663232408635,R=0.6884158028074934,)")
expect(value.toRGBA()).toStrictEqual([176, 7, 11, 213])
expect(value.toRGBAString()).toStrictEqual("B0070BD5")
expect(value.toNumber()).toStrictEqual(-1341715499)
expect(value.toHSVA().map(v => Utility.roundDecimals(v, 3))).toStrictEqual([0.996, 0.961, 0.688, 0.837])
color = serializer.read(`(
value = grammar.parse(`(
A = 0.327 ,
R=0.530 , G = 0.685
,B
= 0.9 ,)`)
expect(color.toRGBA()).toStrictEqual([135, 175, 230, 83])
expect(color.toRGBAString()).toStrictEqual("87AFE653")
expect(color.toNumber()).toStrictEqual(-2018515373)
expect(color.toHSVA().map(v => Utility.roundDecimals(v, 3))).toStrictEqual([0.597, 0.411, 0.9, 0.327])
expect(value.toRGBA()).toStrictEqual([135, 175, 230, 83])
expect(value.toRGBAString()).toStrictEqual("87AFE653")
expect(value.toNumber()).toStrictEqual(-2018515373)
expect(value.toHSVA().map(v => Utility.roundDecimals(v, 3))).toStrictEqual([0.597, 0.411, 0.9, 0.327])
expect(() => serializer.read("(R=0.000000,G=0.660000,A=1.000000)")).toThrow()
expect(() => serializer.read("(R=0.000000,G=\"hello\",A=1.000000)")).toThrow()
value = grammar.parse("(R=0.000000,G=0.660000,A=1.000000)")
expect(value).toEqual(new LinearColorEntity({
R: new ColorChannelEntity(0),
G: new ColorChannelEntity(0.66),
B: new ColorChannelEntity(0),
A: new ColorChannelEntity(1),
}))
})
test("Null", () => {
const serializer = SerializerFactory.getSerializer(null)
expect(serializer.read("()")).toBeNull()
expect(() => serializer.read("123")).toThrow()
expect(() => serializer.read("(a)")).toThrow()
expect(() => serializer.read("(")).toThrow()
test("NullEntity", () => {
const grammar = NullEntity.grammar
let value = grammar.parse("()")
expect(value).toBeInstanceOf(NullEntity)
expect(value).toEqual(new NullEntity())
expect(value.toString()).toEqual("()")
expect(() => grammar.parse("123")).toThrow("Could not parse")
expect(() => grammar.parse("(a)")).toThrow("Could not parse")
expect(() => grammar.parse("(")).toThrow("Could not parse")
})
test("Number", () => {
const serializer = SerializerFactory.getSerializer(Number)
test("NumberEntity", () => {
const grammar = NumberEntity.grammar
expect(serializer.read("0")).toBeCloseTo(0, 0.00001)
expect(serializer.read("+0")).toBeCloseTo(0, 0.00001)
expect(serializer.read("-0")).toBeCloseTo(0, 0.00001)
expect(serializer.read("5")).toBeCloseTo(5, 0.00001)
expect(serializer.read("0.05")).toBeCloseTo(0.05, 0.00001)
expect(serializer.read("-999.666")).toBeCloseTo(-999.666, 0.001)
expect(serializer.read("+45.4545")).toBeCloseTo(45.4545, 0.001)
expect(serializer.read("+1000000000")).toBeCloseTo(1E9, 0.1)
expect(serializer.read("inf")).toBe(Number.POSITIVE_INFINITY)
expect(serializer.read("+inf")).toBe(Number.POSITIVE_INFINITY)
expect(serializer.read("-inf")).toBe(Number.NEGATIVE_INFINITY)
expect(() => serializer.read("alpha")).toThrow()
expect(grammar.parse("0")).toBeCloseTo(0, 0.00001)
expect(grammar.parse("+0")).toBeCloseTo(0, 0.00001)
expect(grammar.parse("-0")).toBeCloseTo(0, 0.00001)
expect(grammar.parse("5")).toBeCloseTo(5, 0.00001)
expect(grammar.parse("0.05")).toBeCloseTo(0.05, 0.00001)
expect(grammar.parse("-999.666")).toBeCloseTo(-999.666, 0.001)
expect(grammar.parse("+45.4545")).toBeCloseTo(45.4545, 0.001)
expect(grammar.parse("+1000000000")).toBeCloseTo(1E9, 0.1)
expect(grammar.parse("inf")).toBe(Number.POSITIVE_INFINITY)
expect(grammar.parse("+inf")).toBe(Number.POSITIVE_INFINITY)
expect(grammar.parse("-inf")).toBe(Number.NEGATIVE_INFINITY)
expect(() => grammar.parse("alpha")).toThrow()
})
test("ObjectReferenceEntity", () => {
@@ -575,7 +631,7 @@ test("String", () => {
})
test("UnknownKeysValue", () => {
const parser = Grammar.unknownValue
const parser = IEntity.unknownEntityGrammar
expect(parser.parse('"Hello"').constructor).toStrictEqual(String)
expect(parser.parse("()")).toBeNull()