Skip to content

Commit

Permalink
[CLN] Reorganised tests and fixed some typos.
Browse files Browse the repository at this point in the history
  • Loading branch information
herom committed May 9, 2014
1 parent b8bae1f commit e4f17f0
Showing 1 changed file with 62 additions and 62 deletions.
124 changes: 62 additions & 62 deletions test/molder_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,67 +130,6 @@ describe("Molder", function () {
model.should.have.property('statusPhrase', 'Batman is happy');
});

it("Should reduce/desolate the model according to the serializable Array in the model-description", function () {
var model = {
name: 'Bruce Wayne',
firstName: 'Bruce',
lastName: 'Wayne'
},
modelDescription = {
__namespace: 'session.user',
firstName: 'firstName',
lastName: 'lastName',
__serializable: ['firstName', 'lastName']
},
reducedModel;

reducedModel = Molder.desolate(modelDescription, model);

reducedModel.should.not.have.property('name');
});

it("Should reduce/desolate the model even without a serializable Array in the model-description", function () {
var model = {
name: 'Bruce Wayne',
firstName: 'Bruce',
lastName: 'Wayne'
},
modelDescription = {
__namespace: 'session.user',
firstName: 'firstName',
lastName: 'lastName'
},
reducedModel;

reducedModel = Molder.desolate(modelDescription, model);

reducedModel.should.not.have.property('namespace');
});

it("Should not reduce/desolate functions", function () {
var model = {
name: 'Bruce Wayne',
firstName: 'Bruce',
lastName: 'Wayne',
greet: function (user) {
return 'Hello ' + user + '! This is ' + this.name + '.';
}
},
modelDescription = {
__namespace: 'session.user',
firstName: 'firstName',
lastName: 'lastName',
greet: function (user) {
return 'Hello ' + user + '! This is ' + this.name + '.';
}
},
reducedModel;

reducedModel = Molder.desolate(modelDescription, model);

reducedModel.should.not.have.property('greet');
});

it("Should return null if the given 'namespace' is not present in the returned JSON", function () {
var origin = {
name: 'Bruce Wayne',
Expand Down Expand Up @@ -615,7 +554,7 @@ describe("Molder", function () {
should(model).eql(expectedModel);
});

it("Schould populate a child properties which are objects and not arrays", function () {
it("Should populate a model with object child properties", function () {
var origin = {
session: {
state: "Active",
Expand Down Expand Up @@ -755,6 +694,67 @@ describe("Molder", function () {
});

describe("#desolate()", function () {
it("Should reduce/desolate the model according to the serializable Array in the model-description", function () {
var model = {
name: 'Bruce Wayne',
firstName: 'Bruce',
lastName: 'Wayne'
},
modelDescription = {
__namespace: 'session.user',
firstName: 'firstName',
lastName: 'lastName',
__serializable: ['firstName', 'lastName']
},
reducedModel;

reducedModel = Molder.desolate(modelDescription, model);

reducedModel.should.not.have.property('name');
});

it("Should reduce/desolate the model even without a serializable Array in the model-description", function () {
var model = {
name: 'Bruce Wayne',
firstName: 'Bruce',
lastName: 'Wayne'
},
modelDescription = {
__namespace: 'session.user',
firstName: 'firstName',
lastName: 'lastName'
},
reducedModel;

reducedModel = Molder.desolate(modelDescription, model);

reducedModel.should.not.have.property('namespace');
});

it("Should not reduce/desolate functions", function () {
var model = {
name: 'Bruce Wayne',
firstName: 'Bruce',
lastName: 'Wayne',
greet: function (user) {
return 'Hello ' + user + '! This is ' + this.name + '.';
}
},
modelDescription = {
__namespace: 'session.user',
firstName: 'firstName',
lastName: 'lastName',
greet: function (user) {
return 'Hello ' + user + '! This is ' + this.name + '.';
}
},
reducedModel;

reducedModel = Molder.desolate(modelDescription, model);

reducedModel.should.not.have.property('greet');
});

it("Should desolate a simple model", function () {
var modelDescription = {
__namespace: 'awesome',
Expand Down

0 comments on commit e4f17f0

Please sign in to comment.