mirror of
https://github.com/barsdeveloper/ueblueprint.git
synced 2026-02-04 08:50:33 +08:00
* Still WIP * WIP * ArrayEntity parsing fixed * Fix format text entity * Tests for various entity classes and update entity class implementations * More tests and fixed * More entities fixed * Simple entities serialization fixed * Entities tests fixed * Remove serialization bits * Fix Function reference * CustomProperties creating fixed * WIP * Better typing for grammars * Decoding code fixes * Fixing still * Several fixes * rename toString to serialize * Several fixes * More fixes * Moving more stuff out of Utility * Several fixes * Fixing Linear color entity print * Serialization fixes * Fix serialization * Method to compute grammar * Renaming fix * Fix array grammar and equality check * Fix inlined keys * Fix type * Several serialization fixes * Fix undefined dereference * Several fixes * More fixes and cleanup * Fix keys quoting mechanism * Fix natural number assignment * Fix Int64 toString() * Fix quoted keys for inlined arrays * Fix PG pins * Fix several test cases * Types fixes * New pin default value empty * Fix non existing DefaultValue for variadic nodes * Smaller fixes for crashes * Fix link color when attached to knot * Linking test and more reliability operations for adding pins * Improve issue 18 test * More tests and fixes * Fix enum pin entity * Remove failing test
70 lines
2.1 KiB
JavaScript
70 lines
2.1 KiB
JavaScript
// @ts-nocheck
|
|
|
|
import StringEntity from "../js/entity/StringEntity.js"
|
|
import initializeSerializerFactory from "../js/serialization/initializeSerializerFactory.js"
|
|
import { expect, test } from "./fixtures/test.js"
|
|
import Entity1 from "./resources/Entity1.js"
|
|
import Entity2 from "./resources/Entity2.js"
|
|
import Entity3 from "./resources/Entity3.js"
|
|
import Entity4 from "./resources/Entity4.js"
|
|
import entity2Value1 from "./resources/serializedEntity2-1.js"
|
|
import entity2Value from "./resources/serializedEntity2.js"
|
|
import entity3Value from "./resources/serializedEntity3.js"
|
|
import entity4Value from "./resources/serializedEntity4.js"
|
|
|
|
test.beforeAll(() => initializeSerializerFactory())
|
|
|
|
test.describe.configure({ mode: "parallel" })
|
|
|
|
test("Entity2", () => {
|
|
const value = new Entity2()
|
|
expect(Object.keys(value)).toHaveLength(9)
|
|
expect(value.serialize()).toEqual(entity2Value)
|
|
const other = new Entity2({ someString2: new StringEntity("gamma") })
|
|
expect(value.equals(other)).toBeFalsy()
|
|
other.someString2 = new StringEntity("beta")
|
|
expect(value.equals(other)).toBeTruthy()
|
|
})
|
|
|
|
test("Entity2-1", () => {
|
|
Entity2.attributes.someEntity = Entity2.attributes.someEntity.flagInlined()
|
|
const value = new Entity2()
|
|
expect(value.serialize()).toEqual(entity2Value1)
|
|
})
|
|
|
|
test("Entity3", () => {
|
|
let value = new Entity3()
|
|
const keys = [
|
|
"alpha",
|
|
"bravo",
|
|
"charlie",
|
|
"delta",
|
|
"echo",
|
|
"foxtrot",
|
|
"golf",
|
|
"hotel",
|
|
"india",
|
|
"juliett",
|
|
"kilo",
|
|
// "lima", // Not defined by default
|
|
"mike",
|
|
"november",
|
|
"oscar",
|
|
"papa",
|
|
// "quebec", // Not defined by default
|
|
"romeo",
|
|
"sierra",
|
|
]
|
|
expect(Object.keys(value)).toStrictEqual(keys)
|
|
expect(value.serialize()).toEqual(entity3Value)
|
|
})
|
|
|
|
test("Entity4", () => {
|
|
Entity1.attributeSeparator = " - "
|
|
Entity1.keySeparator = ":"
|
|
Entity1.printKey = k => k.toUpperCase()
|
|
Entity1.wrap = (entity, v) => `E1[${v}]`
|
|
const entity = new Entity4()
|
|
expect(entity.serialize()).toEqual(entity4Value)
|
|
})
|