should wrap param object with method matching calling method name and add to array of newEvents.
var param = {
data: 'data'
};
var test = new TestEntity(),
data = { test: 'data' };
test.method(data);
test.newEvents.length.should.equal(1);
test.newEvents[0].method.should.equal('method');
test.newEvents[0].data.should.equal(data);
should marge a snapshot into the current object, overwriting any common properties.
var snapshot = {
property: true,
property2: true
};
var test = new TestEntity();
test.merge(snapshot);
test.property.should.equal(true);
test.property2.should.equal(true);
should throw an entity error with name of model when attempting to replay a method an entity does not implement.
var events = [
{
method: 'someMethod',
data: { some: 'param' }
}
];
var test = new TestEntity();
(function () {
test.replay(events);
}).should.throw('method \'someMethod\' does not exist on model \'TestEntity\'');
should return object with current state of the entity.
;
var param = {
data: 'data'
};
var test = new TestEntity(),
data = { data: 'data' };
test.method(data);
var snapshot = test.snapshot();
snapshot.property2.should.equal(data.data);
snapshot.snapshotVersion.should.equal(1);
snapshot.version.should.equal(1);
should be immutable.
var value = Value({
property: 'value'
});
value.should.have.property('property', 'value');
value.property = 'new value';
value.should.have.property('property', 'value');