Skip to content

Commit

Permalink
Test cleanup
Browse files Browse the repository at this point in the history
Add a lot of `toString`s to test classes, as a debugging convenience.
  • Loading branch information
hjdivad committed Oct 21, 2016
1 parent 41193f7 commit cede314
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/integration/adapter/find-all-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ module("integration/adapter/find_all - Finding All Records of a Type", {
firstName: attr('string'),
lastName: attr('string')
});
Person.reopenClass({ toString() { return 'Person'; } });

allRecords = null;

Expand Down
3 changes: 3 additions & 0 deletions tests/integration/records/unload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,19 @@ var Person = DS.Model.extend({
name: attr('string'),
cars: hasMany('car', { async: false })
});
Person.reopenClass({ toString() { return 'Person'; } });

var Group = DS.Model.extend({
people: hasMany('person', { async: false })
});
Group.reopenClass({ toString() { return 'Group'; } });

var Car = DS.Model.extend({
make: attr('string'),
model: attr('string'),
person: belongsTo('person', { async: false })
});
Car.reopenClass({ toString() { return 'Car'; } });

module("integration/unload - Unloading Records", {
beforeEach() {
Expand Down
11 changes: 11 additions & 0 deletions tests/integration/relationships/has-many-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,44 +29,53 @@ module("integration/relationships/has_many - Has-Many Relationships", {
Contact = DS.Model.extend({
user: belongsTo('user', { async: false })
});
Contact.reopenClass({ toString: () => 'Contact' });

Email = Contact.extend({
email: attr('string')
});
Email.reopenClass({ toString: () => 'Email' });

Phone = Contact.extend({
number: attr('string')
});
Phone.reopenClass({ toString: () => 'Phone' });

Message = DS.Model.extend({
user: belongsTo('user', { async: false }),
created_at: attr('date')
});
Message.reopenClass({ toString: () => 'Message' });

Post = Message.extend({
title: attr('string'),
comments: hasMany('comment', { async: false })
});
Post.reopenClass({ toString: () => 'Post' });

Comment = Message.extend({
body: DS.attr('string'),
message: DS.belongsTo('post', { polymorphic: true, async: true })
});
Comment.reopenClass({ toString: () => 'Comment' });

Book = DS.Model.extend({
title: attr(),
chapters: hasMany('chapter', { async: true })
});
Book.reopenClass({ toString: () => 'Book' });

Chapter = DS.Model.extend({
title: attr(),
pages: hasMany('page', { async: false })
});
Chapter.reopenClass({ toString: () => 'Chapter' });

Page = DS.Model.extend({
number: attr('number'),
chapter: belongsTo('chapter', { async: false })
});
Page.reopenClass({ toString: () => 'Page' });

env = setupStore({
user: User,
Expand Down Expand Up @@ -2196,10 +2205,12 @@ test("adding and removing records from hasMany relationship #2666", function(ass
var Post = DS.Model.extend({
comments: DS.hasMany('comment', { async: true })
});
Post.reopenClass({ toString: () => 'Post' });

var Comment = DS.Model.extend({
post: DS.belongsTo('post', { async: false })
});
Comment.reopenClass({ toString: () => 'Comment' });

env = setupStore({
post: Post,
Expand Down
2 changes: 2 additions & 0 deletions tests/integration/store-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ var Person = DS.Model.extend({
name: DS.attr('string'),
cars: DS.hasMany('car', { async: false })
});
Person.reopenClass({ toString: () => 'Person' });

var run = Ember.run;

Expand All @@ -21,6 +22,7 @@ var Car = DS.Model.extend({
model: DS.attr('string'),
person: DS.belongsTo('person', { async: false })
});
Car.reopenClass({ toString: () => 'Car' });

function initializeStore(adapter) {
env = setupStore({
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/many-array-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,13 @@ module("unit/many_array - DS.ManyArray", {
title: attr('string'),
tags: hasMany('tag', { async: false })
});
Post.reopenClass({ toString: () => 'Post'});

Tag = DS.Model.extend({
name: attr('string'),
post: belongsTo('post', { async: false })
});
Tag.reopenClass({ toString: () => 'Tag'});

env = setupStore({
post: Post,
Expand Down
1 change: 1 addition & 0 deletions tests/unit/model/rollback-attributes-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module("unit/model/rollbackAttributes - model.rollbackAttributes()", {
firstName: DS.attr(),
lastName: DS.attr()
});
Person.reopenClass({ toString() { return 'Person'; } });

env = setupStore({ person: Person });
store = env.store;
Expand Down
5 changes: 5 additions & 0 deletions tests/unit/store/unload-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ module("unit/store/unload - Store unloading records", {
title: DS.attr('string'),
wasFetched: DS.attr('boolean')
});
Record.reopenClass({ toString: () => 'Record'});

store = createStore({
adapter: DS.Adapter.extend({
findRecord(store, type, id, snapshot) {
Expand Down Expand Up @@ -108,15 +110,18 @@ test("can commit store after unload record with relationships", function(assert)
var Brand = DS.Model.extend({
name: DS.attr('string')
});
Brand.reopenClass({ toString: () => 'Brand'});

var Product = DS.Model.extend({
description: DS.attr('string'),
brand: DS.belongsTo('brand', { async: false })
});
Product.reopenClass({ toString: () => 'Product'});

var Like = DS.Model.extend({
product: DS.belongsTo('product', { async: false })
});
Like.reopenClass({ toString: () => 'Like'});

var store = createStore({
adapter: DS.Adapter.extend({
Expand Down

0 comments on commit cede314

Please sign in to comment.