@@ -1411,11 +1411,27 @@ describe("Model", () => {
14111411
14121412 describe ( "#dup()" , ( ) => {
14131413 it ( "returns a new instance of the same object" , ( ) => {
1414- let author = new Author ( { firstName : "Stephen" } )
1414+ let author = new Author ( { id : '1' , firstName : "Stephen" } )
1415+ author . isPersisted = true
1416+ author . isMarkedForDestruction = true
1417+ author . isMarkedForDisassociation = true
1418+
1419+ let errors = { firstName : { title : "asdf" } } as any
1420+ author . errors = errors
14151421 let duped = author . dup ( )
14161422 duped . firstName = "updated"
14171423 expect ( author . firstName ) . to . eq ( "Stephen" )
14181424 expect ( duped . firstName ) . to . eq ( "updated" )
1425+ expect ( duped . id ) . to . eq ( "1" )
1426+ expect ( duped . isPersisted ) . to . eq ( true )
1427+ expect ( duped . isMarkedForDestruction ) . to . eq ( true )
1428+ expect ( duped . isMarkedForDisassociation ) . to . eq ( true )
1429+ expect ( duped . errors ) . to . deep . equal ( { firstName : { title : "asdf" } } )
1430+ duped . isPersisted = false
1431+ expect ( author . isPersisted ) . to . eq ( true )
1432+ let dupErrors = duped . errors as any
1433+ dupErrors . firstName = "new"
1434+ expect ( author . errors . firstName ) . to . deep . eq ( { title : "asdf" } )
14191435 } )
14201436
14211437 it ( "does not recast nonenumerables to enumerable" , ( ) => {
0 commit comments