mirror of
https://github.com/zoriya/typebox.git
synced 2026-06-02 02:55:05 +00:00
@@ -68,4 +68,19 @@ describe('value/create/Object', () => {
|
||||
z: 3,
|
||||
})
|
||||
})
|
||||
// ----------------------------------------------------------------
|
||||
// Mutation
|
||||
// ----------------------------------------------------------------
|
||||
// https://github.com/sinclairzx81/typebox/issues/726
|
||||
it('Should clone defaults on assignment - no mutation', () => {
|
||||
const T = Type.Object(
|
||||
{
|
||||
x: Type.Number(),
|
||||
},
|
||||
{ default: { x: 1 } },
|
||||
)
|
||||
const V = Value.Create(T)
|
||||
V.x = 123
|
||||
Assert.IsEqual(T.default, { x: 1 })
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user