Fix the failing unit test
[potlatch2.git] / tests / src / net / systemeD / halcyon / connection / actions / AddMemberToRelationActionTest.as
1 package net.systemeD.halcyon.connection.actions {
2
3     import org.flexunit.Assert;
4     import net.systemeD.halcyon.connection.actions.AddMemberToRelationAction;
5     import net.systemeD.halcyon.connection.Relation;
6     import net.systemeD.halcyon.connection.Node;
7     import net.systemeD.halcyon.connection.RelationMember;
8     import net.systemeD.halcyon.connection.UndoableAction;
9     import net.systemeD.halcyon.connection.*;
10
11     public class AddMemberToRelationActionTest {
12
13         [Test]
14         public function addMember():void {
15
16             var n:Node = new Node(1,1,{},true,5,10);
17
18             var rel:Relation = new Relation(1,1,{},true,[]);
19             var member:RelationMember = new RelationMember(n, "foo");
20
21             //Instantiate the connection first to prevent errors
22             Connection.getConnection();
23             rel.appendMember(member, function(action:UndoableAction):void { action.doAction(); })
24             Assert.assertEquals(1, rel.length);
25
26         }
27
28         [Test]
29         public function spliceStuff():void {
30
31             var arr:Array = ["a", "b", "c", "d"];
32             Assert.assertEquals(arr.length, 4);
33
34             arr.splice(-1, 0, "e");
35             Assert.assertEquals(arr.length, 5);
36
37             arr.splice(-1, 1);
38             Assert.assertEquals(arr.length, 4);
39         }
40     }
41 }