Skip to content

Commit

Permalink
Update persistence tests
Browse files Browse the repository at this point in the history
  • Loading branch information
danschultz committed Mar 24, 2012
1 parent c9d591f commit fb48483
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 63 deletions.
29 changes: 25 additions & 4 deletions tests/mesh/model/RecordCommitTests.as
Expand Up @@ -38,10 +38,10 @@ package mesh.model
_store = new Store(_dataSources);
}

private function assertIsSynced(record:Record):void
private function assertIsSynced(record:Record, isRemote:Boolean):void
{
assertThat(ID.isPopulated(record), equalTo(true));
assertThat(record.state.isRemote, equalTo(true));
assertThat(record.state.isRemote, equalTo(isRemote));
assertThat(record.state.isSynced, equalTo(true));
}

Expand All @@ -50,7 +50,7 @@ package mesh.model
{
var test:AsyncTest = new AsyncTest(this, LATENCY+100, function():void
{
assertIsSynced(customer);
assertIsSynced(customer, true);
});

var customer:Customer = _store.create(Customer);
Expand All @@ -62,12 +62,33 @@ package mesh.model
assertThat(customer.state.isBusy, equalTo(true));
}

[Test(async)]
public function testDestroy():void
{
var test:AsyncTest = new AsyncTest(this, LATENCY+(200*2), function():void
{
assertIsSynced(customer, false);
});

var customer:Customer = _store.query(Customer).find(1);
customer.loadOperation.addEventListener(FinishedOperationEvent.FINISHED, function(event:FinishedOperationEvent):void
{
customer.destroy().persist(new CommitResponder(function():void
{
test.complete();
}));

assertThat(customer.state.isBusy, equalTo(true));
});
customer.load();
}

[Test(async)]
public function testUpdate():void
{
var test:AsyncTest = new AsyncTest(this, LATENCY+(200*2), function():void
{
assertIsSynced(customer);
assertIsSynced(customer, true);
});

var customer:Customer = _store.query(Customer).find(1);
Expand Down
59 changes: 0 additions & 59 deletions tests/mesh/model/RecordPersistenceTests.as

This file was deleted.

0 comments on commit fb48483

Please sign in to comment.