Fixes and Utility test added

This commit is contained in:
barsdeveloper
2023-01-04 15:53:51 +01:00
parent 6230da391f
commit f59217ffd9
9 changed files with 277 additions and 81 deletions

View File

@@ -8,21 +8,19 @@ describe('empty spec', () => {
cy.get("ueb-blueprint")
.click(100, 300)
.then(blueprint => Utility.paste(blueprint[0], String.raw`
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_7"
FunctionReference=(MemberParent=/Script/CoreUObject.Class'"/Script/UMG.WidgetBlueprintLibrary"',MemberName="DrawLine")
NodePosX=-400
NodePosY=-496
AdvancedPinDisplay=Hidden
NodeGuid=1E381F16F1004F99B8FA2B31A302B728
CustomProperties Pin (PinId=9450390250EA422BAF09BEC8929A9294,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=C83869E5A13240F6B14F812FDB0AB4C2,PinName="then",PinToolTip="\nExec",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=29F8D8746CF548D28EB5C459761706DE,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nWidget Blueprint Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/UMG.WidgetBlueprintLibrary"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/UMG.Default__WidgetBlueprintLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=D776BF6820F34C91BE75B9952CC791BE,PinName="Context",PinToolTip="Context\nPaint Context Structure (by ref)",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/UMG.PaintContext"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=4CABFB9E228940589C5A6DE7D4F4D084,PinName="PositionA",PinToolTip="Position A\nVector 2D Structure\n\nStarting position of the line in local space.",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector2D"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=F688B2830ED74443B306F450C430B45C,PinName="PositionB",PinToolTip="Position B\nVector 2D Structure\n\nEnding position of the line in local space.",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector2D"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=6A10CA2DBB4C4F23A9B61417A4039F6F,PinName="Tint",PinToolTip="Tint\nLinear Color Structure\n\nColor to render the line.",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.LinearColor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",AutogeneratedDefaultValue="(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=7A6AC1B873304455A159B2434E733265,PinName="bAntiAlias",PinToolTip="Anti Alias\nBoolean\n\nWhether the line should be antialiased.",PinType.PinCategory="bool",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="true",AutogeneratedDefaultValue="true",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
CustomProperties Pin (PinId=9F002C20FBB94382B2AB8CC59B28BDA4,PinName="Thickness",PinToolTip="Thickness\nFloat (single-precision)\n\nHow many pixels thick this line should be.",PinType.PinCategory="real",PinType.PinSubCategory="float",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="1.000000",AutogeneratedDefaultValue="1.000000",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=True,bOrphanedPin=False,)
Begin Object Class=/Script/BlueprintGraph.K2Node_CallFunction Name="K2Node_CallFunction_0"
FunctionReference=(MemberParent=/Script/CoreUObject.Class'"/Script/UMG.WidgetBlueprintLibrary"',MemberName="DrawBox")
NodePosX=-528
NodePosY=16
NodeGuid=CCD05D4C46B44D439A8A54892EF35583
CustomProperties Pin (PinId=5FBDA39535314BB8A54233DACD0127B5,PinName="execute",PinToolTip="\nExec",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=50CAADA252984578932EC85ABF55694C,PinName="then",PinToolTip="\nExec",Direction="EGPD_Output",PinType.PinCategory="exec",PinType.PinSubCategory="",PinType.PinSubCategoryObject=None,PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=55779C53183948C1B4EF08ADB42E06EB,PinName="self",PinFriendlyName=NSLOCTEXT("K2Node", "Target", "Target"),PinToolTip="Target\nWidget Blueprint Library Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/UMG.WidgetBlueprintLibrary"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultObject="/Script/UMG.Default__WidgetBlueprintLibrary",PersistentGuid=00000000000000000000000000000000,bHidden=True,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=7EB988E8F2B4448AAE788347A8B1A52A,PinName="Context",PinToolTip="Context\nPaint Context Structure (by ref)",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/UMG.PaintContext"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=True,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=6FC51CC5388D41A19A21A3BBB73D709D,PinName="Position",PinToolTip="Position\nVector 2D Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector2D"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=CFF6C22A93A44624B9E9D3062A0D2C92,PinName="Size",PinToolTip="Size\nVector 2D Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.Vector2D"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=0F39A82607874DEBB85E7CF660A8CEE5,PinName="Brush",PinToolTip="Brush\nSlate Brush Asset Object Reference",PinType.PinCategory="object",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.Class'"/Script/Engine.SlateBrushAsset"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
CustomProperties Pin (PinId=24480A396D474F85A2891846975A2AC6,PinName="Tint",PinToolTip="Tint\nLinear Color Structure",PinType.PinCategory="struct",PinType.PinSubCategory="",PinType.PinSubCategoryObject=/Script/CoreUObject.ScriptStruct'"/Script/CoreUObject.LinearColor"',PinType.PinSubCategoryMemberReference=(),PinType.PinValueType=(),PinType.ContainerType=None,PinType.bIsReference=False,PinType.bIsConst=False,PinType.bIsWeakPointer=False,PinType.bIsUObjectWrapper=False,PinType.bSerializeAsSinglePrecisionFloat=False,DefaultValue="(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",AutogeneratedDefaultValue="(R=1.000000,G=1.000000,B=1.000000,A=1.000000)",PersistentGuid=00000000000000000000000000000000,bHidden=False,bNotConnectable=False,bDefaultValueIsReadOnly=False,bDefaultValueIsIgnored=False,bAdvancedView=False,bOrphanedPin=False,)
End Object
`))
})

View File

@@ -155,27 +155,28 @@ describe("Entity initialization", () => {
.which.is.instanceOf(SimpleObject)
.and.is.deep.equal({ a: 12, b: 13 })
)
it("has quebec, a number between 1 and 10", () => expect(entity)
it("has quebec undefined", () => expect(entity)
.to.have.property("quebec")
.which.is.a("number")
.and.is.equal(1)
.which.is.undefined
)
it("quebec can be assigned and it always filtered", () => {
const entity = new ComplexEntity()
entity.quebec = 2
expect(entity.quebec).to.be.equal(2)
expect(entity.quebec, "assigned 2").to.be.equal(2)
entity["quebec"] = 7
expect(entity.quebec).to.be.equal(7)
expect(entity.quebec, "assigned 7").to.be.equal(7)
entity.quebec = 1
expect(entity.quebec).to.be.equal(1)
expect(entity.quebec, "assigned 1").to.be.equal(1)
entity["quebec"] = 10
expect(entity.quebec).to.be.equal(10)
expect(entity.quebec, "assigned 10").to.be.equal(10)
entity.quebec = 0
expect(entity.quebec).to.be.equal(1)
expect(entity.quebec, "assigned 0").to.be.equal(10)
entity["quebec"] = 11
expect(entity.quebec).to.be.equal(10)
expect(entity.quebec, "assigned 11").to.be.equal(10)
entity.quebec = -1
expect(entity.quebec).to.be.equal(1)
expect(entity.quebec, "assigned -1").to.be.equal(10)
entity.quebec = 6
expect(entity.quebec, "assigned 6").to.be.equal(6)
})
})
})

147
cypress/e2e/utility.cy.js Normal file
View File

@@ -0,0 +1,147 @@
/// <reference types="cypress" />
import Utility from "../../js/Utility"
describe("Utility functions testing", () => {
before(() => {
expect(Utility,).to.be.a("function")
})
context("Utility", () => {
it("clamp method test", () => {
expect(Utility.clamp(-4, -3)).to.be.equal(-3)
expect(Utility.clamp(-1, -3, -2)).to.be.equal(-2)
expect(Utility.clamp(5, 1, 11)).to.be.equal(5)
})
it("minDecimals method test", () => {
expect(Utility.minDecimals(3.1, 3)).to.be.equal("3.100")
expect(Utility.minDecimals(-100, 2)).to.be.equal("-100.00")
expect(Utility.minDecimals(0.43, 0)).to.be.equal("0.43")
expect(Utility.minDecimals(0.43, 1)).to.be.equal("0.43")
expect(Utility.minDecimals(0.43, 2)).to.be.equal("0.43")
expect(Utility.minDecimals(0.43, 3)).to.be.equal("0.430")
expect(Utility.minDecimals(-2, 0)).to.be.equal("-2")
})
it("roundDecimals method test", () => {
expect(Utility.roundDecimals(8.543943, 0)).to.be.equal(9)
expect(Utility.roundDecimals(8.543943, 1)).to.be.equal(8.5)
expect(Utility.roundDecimals(8.543943, 2)).to.be.equal(8.54)
expect(Utility.roundDecimals(8.543943, 3)).to.be.equal(8.544)
expect(Utility.roundDecimals(-2.192837, 0)).to.be.equal(-2)
expect(Utility.roundDecimals(-2.192837, 1)).to.be.equal(-2.2)
expect(Utility.roundDecimals(-2.192837, 2)).to.be.equal(-2.19)
expect(Utility.roundDecimals(-2.192837, 3)).to.be.equal(-2.193)
expect(Utility.roundDecimals(-2.192837, 4)).to.be.equal(-2.1928)
})
it("approximatelyEqual method test", () => {
expect(Utility.approximatelyEqual(0.2 + 0.1, 0.3)).to.be.true
expect(Utility.approximatelyEqual(-0.2 - 0.1, -0.3)).to.be.true
expect(Utility.approximatelyEqual(0.1000001, 0.1)).to.be.false
expect(Utility.approximatelyEqual(40.1 + 0.2, 40.3)).to.be.true
expect(Utility.approximatelyEqual(2, 3)).to.be.false
})
it("equals method test", () => {
expect(Utility.equals(0.2, 0.2)).to.be.true
expect(Utility.equals(new Number(0.7), 0.7)).to.be.true
expect(Utility.equals(-40.3, new Number(-40.3))).to.be.true
expect(Utility.equals(new Number(-40.3), new Number(-40.3))).to.be.true
expect(Utility.equals(0.2 + 0.1, 0.3)).to.be.false // Strict equality
expect(Utility.equals(null, undefined)).to.be.false
expect(Utility.equals(undefined, null)).to.be.false
expect(Utility.equals(0, false)).to.be.false
expect(Utility.equals(false, false)).to.be.true
expect(Utility.equals(2n, 2)).to.be.true
expect(Utility.equals(-6845, -6845n)).to.be.true
expect(Utility.equals(7735n, 7736)).to.be.false
expect(Utility.equals("abc", "abc")).to.be.true
expect(Utility.equals(new String("abc"), new String("abc"))).to.be.true
expect(Utility.equals("abc", "aBc")).to.be.false
expect(Utility.equals(
[-2, "alpha", new String("beta"), new Number(40), [1, 2, 3]],
[new Number(-2), new String("alpha"), new String("beta"), new Number(40), new Array(1, 2, 3)]
)).to.be.true
expect(Utility.equals(
[-2.1, "alpha", new String("beta"), new Number(40), [1, 2, 3]],
[new Number(-2), new String("alpha"), new String("beta"), new Number(40), new Array(1, 2, 3)]
)).to.be.false // First element is different
expect(Utility.equals(
[-2, "Alpha", new String("beta"), new Number(40), [1, 2, 3]],
[new Number(-2), new String("alpha"), new String("beta"), new Number(40), new Array(1, 2, 3)]
)).to.be.false // Second element is different
})
it("isValueOfType method test", () => {
expect(Utility.isValueOfType(34, Number)).to.be.true
expect(Utility.isValueOfType(new Number(34), Number)).to.be.true
expect(Utility.isValueOfType("34", String)).to.be.true
expect(Utility.isValueOfType("34", Number)).to.be.false
})
it("mergeArrays method test", () => {
expect(Utility.mergeArrays(
[],
[]
)).to.be.deep.equal(
[]
)
expect(Utility.mergeArrays(
["alpba", "beta"],
[]
)).to.be.deep.equal(
["alpba", "beta"]
)
expect(Utility.mergeArrays(
[],
["alpba", "beta"]
)).to.be.deep.equal(
["alpba", "beta"]
)
expect(Utility.mergeArrays(
[1, 3, 5, 7, 9],
[1, 2, 3, 4, 5]
)).to.be.deep.equal(
[1, 2, 3, 4, 5, 7, 9]
)
expect(Utility.mergeArrays(
[6, 7, 8],
[1, 2, 3]
)).to.be.deep.equal(
[6, 7, 8, 1, 2, 3]
)
expect(Utility.mergeArrays(
["e", "f", "g", "h"],
["a", "b", "c", "d"]
)).to.be.deep.equal(
["e", "f", "g", "h", "a", "b", "c", "d"]
)
expect(Utility.mergeArrays(
["e", "f", "g", "h"],
["a", "b", "c", "d", "e"]
)).to.be.deep.equal(
["a", "b", "c", "d", "e", "f", "g", "h"]
)
expect(Utility.mergeArrays(
[2, 4, 6, 8],
[6, 4, 2]
)).to.be.deep.equal(
[2, 4, 6, 8]
)
expect(Utility.mergeArrays(
[2, 4, 6, 8],
[4, 5, 6, 8, 1, 2]
)).to.be.deep.equal(
[2, 4, 5, 6, 8, 1]
)
})
it("capitalFirstLetter method test", () => {
expect(Utility.capitalFirstLetter("")).to.be.equal("")
expect(Utility.capitalFirstLetter("hello world")).to.be.equal("Hello world")
})
it("range method test", () => {
expect(Utility.range()).to.be.deep.equal([])
expect(Utility.range(5, 5)).to.be.deep.equal([])
expect(Utility.range(5, 6)).to.be.deep.equal([5])
expect(Utility.range(1, 10, 3)).to.be.deep.equal([1, 4, 7])
expect(Utility.range(0, -3)).to.be.deep.equal([0, -1, -2])
expect(Utility.range(7, -7, -4)).to.be.deep.equal([7, 3, -1, -5])
})
})
})

View File

@@ -58,8 +58,8 @@ export default class ComplexEntity extends IEntity {
},
papa: () => new SimpleObject(12, 13),
quebec: {
value: 0, // will assign 1 according to filter
filter: v => Utility.clamp(v, 1, 10),
value: 0, // will assign undefined because it does not satisfy the predicate
predicate: v => v >= 1 && v <= 10,
},
}