Skip to content

Commit

Permalink
[CLEANUP] ember watson:methodify tests/
Browse files Browse the repository at this point in the history
Convert to ES6 function declarations in tests.
  • Loading branch information
seanpdoyle committed Dec 2, 2015
1 parent ef6c167 commit 9a57fa0
Show file tree
Hide file tree
Showing 68 changed files with 311 additions and 311 deletions.
4 changes: 2 additions & 2 deletions tests/helpers/ember-assertions/deprecations.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const deprecations = {
NONE: 99, // 99 problems and a deprecation ain't one
expecteds: null,
actuals: null,
stubEmber: function() {
stubEmber() {
if (!deprecations.originalEmberDeprecate && Ember.deprecate !== deprecations.originalEmberDeprecate) {
deprecations.originalEmberDeprecate = Ember.deprecate;
}
Expand All @@ -13,7 +13,7 @@ const deprecations = {
deprecations.actuals.push([msg, test]);
};
},
restoreEmber: function() {
restoreEmber() {
Ember.deprecate = deprecations.originalEmberDeprecate;
}
};
Expand Down
10 changes: 5 additions & 5 deletions tests/helpers/ember-assertions/method-call-expectation.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,29 @@ export default function MethodCallExpectation(target, property, testAssert) {
}

MethodCallExpectation.prototype = {
handleCall: function() {
handleCall() {
this.sawCall = true;
return this.originalMethod.apply(this.target, arguments);
},
stubMethod: function(fn) {
stubMethod(fn) {
var context = this;
this.originalMethod = this.target[this.property];
this.target[this.property] = function() {
return context.handleCall.apply(context, arguments);
};
},
restoreMethod: function() {
restoreMethod() {
this.target[this.property] = this.originalMethod;
},
runWithStub: function(fn) {
runWithStub(fn) {
try {
this.stubMethod();
fn();
} finally {
this.restoreMethod();
}
},
assert: function(fn) {
assert(fn) {
this.runWithStub();
this.testAssert.ok(this.sawCall, "Expected "+this.property+" to be called.");
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/adapter/build-url-mixin-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var passedUrl;
var run = Ember.run;

module("integration/adapter/build-url-mixin - BuildURLMixin with RESTAdapter", {
beforeEach: function() {
beforeEach() {
Post = DS.Model.extend({
name: DS.attr("string")
});
Expand Down Expand Up @@ -156,7 +156,7 @@ test('buildURL - with full URLs in links', function(assert) {

test('buildURL - with camelized names', function(assert) {
adapter.setProperties({
pathForType: function(type) {
pathForType(type) {
var decamelized = Ember.String.decamelize(type);
return Ember.String.underscore(Ember.String.pluralize(decamelized));
}
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/adapter/json-api-adapter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ var run = Ember.run;
var User, Post, Comment, Handle, GithubHandle, TwitterHandle, Company, DevelopmentShop, DesignStudio;

module('integration/adapter/json-api-adapter - JSONAPIAdapter', {
beforeEach: function() {
beforeEach() {
User = DS.Model.extend({
firstName: DS.attr('string'),
lastName: DS.attr('string'),
Expand Down Expand Up @@ -76,7 +76,7 @@ module('integration/adapter/json-api-adapter - JSONAPIAdapter', {
adapter = env.adapter;
},

afterEach: function() {
afterEach() {
run(env.store, 'destroy');
}
});
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/adapter/queries-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var Person, env, store, adapter;
var run = Ember.run;

module("integration/adapter/queries - Queries", {
beforeEach: function() {
beforeEach() {
Person = DS.Model.extend({
updatedAt: DS.attr('string'),
name: DS.attr('string'),
Expand All @@ -23,7 +23,7 @@ module("integration/adapter/queries - Queries", {
adapter = env.adapter;
},

afterEach: function() {
afterEach() {
run(env.container, 'destroy');
}
});
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/adapter/record-persistence-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ var all = Ember.RSVP.all;
var hash = Ember.RSVP.hash;

module("integration/adapter/record_persistence - Persisting Records", {
beforeEach: function() {
beforeEach() {
Person = DS.Model.extend({
updatedAt: attr('string'),
name: attr('string'),
Expand All @@ -33,7 +33,7 @@ module("integration/adapter/record_persistence - Persisting Records", {
store = env.store;
},

afterEach: function() {
afterEach() {
run(env.container, 'destroy');
}
});
Expand Down
24 changes: 12 additions & 12 deletions tests/integration/adapter/rest-adapter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ var run = Ember.run;
var get = Ember.get;

module("integration/adapter/rest_adapter - REST Adapter", {
beforeEach: function() {
beforeEach() {
Post = DS.Model.extend({
name: DS.attr("string")
});
Expand Down Expand Up @@ -332,7 +332,7 @@ test("create - a serializer's attribute mapping takes precdence over keyForAttri
name: 'given_name'
},

keyForAttribute: function(attr) {
keyForAttribute(attr) {
return attr.toUpperCase();
}
}));
Expand All @@ -354,7 +354,7 @@ test("create - a serializer's attribute mapping takes precedence over keyForRela
post: 'article'
},

keyForRelationship: function(attr, kind) {
keyForRelationship(attr, kind) {
return attr.toUpperCase();
}
}));
Expand All @@ -379,7 +379,7 @@ test("create - a serializer's attribute mapping takes precedence over keyForRela
comments: 'opinions'
},

keyForRelationship: function(attr, kind) {
keyForRelationship(attr, kind) {
return attr.toUpperCase();
}
}));
Expand Down Expand Up @@ -1994,14 +1994,14 @@ test('groupRecordsForFindMany groups records correctly when singular URLs are en

test('normalizeKey - to set up _ids and _id', function(assert) {
env.registry.register('serializer:application', DS.RESTSerializer.extend({
keyForAttribute: function(attr) {
keyForAttribute(attr) {
return Ember.String.underscore(attr);
},

keyForBelongsTo: function(belongsTo) {
keyForBelongsTo(belongsTo) {
},

keyForRelationship: function(rel, kind) {
keyForRelationship(rel, kind) {
if (kind === 'belongsTo') {
var underscored = Ember.String.underscore(rel);
return underscored + '_id';
Expand Down Expand Up @@ -2166,7 +2166,7 @@ test("calls adapter.handleResponse with the jqXHR and json", function(assert) {
var originalAjax = Ember.$.ajax;
var jqXHR = {
status: 200,
getAllResponseHeaders: function() { return ''; }
getAllResponseHeaders() { return ''; }
};
var data = {
post: {
Expand Down Expand Up @@ -2200,7 +2200,7 @@ test('calls handleResponse with jqXHR, jqXHR.responseText', function(assert) {
var jqXHR = {
status: 400,
responseText: 'Nope lol',
getAllResponseHeaders: function() { return ''; }
getAllResponseHeaders() { return ''; }
};

Ember.$.ajax = function(hash) {
Expand Down Expand Up @@ -2228,7 +2228,7 @@ test("rejects promise if DS.AdapterError is returned from adapter.handleResponse
assert.expect(3);
var originalAjax = Ember.$.ajax;
var jqXHR = {
getAllResponseHeaders: function() { return ''; }
getAllResponseHeaders() { return ''; }
};
var data = {
something: 'is invalid'
Expand Down Expand Up @@ -2259,7 +2259,7 @@ test('on error appends errorThrown for sanity', function(assert) {
var originalAjax = Ember.$.ajax;
var jqXHR = {
responseText: 'Nope lol',
getAllResponseHeaders: function() { return ''; }
getAllResponseHeaders() { return ''; }
};

var errorThrown = new Error('nope!');
Expand Down Expand Up @@ -2291,7 +2291,7 @@ test('on error wraps the error string in an DS.AdapterError object', function(as
var originalAjax = Ember.$.ajax;
var jqXHR = {
responseText: '',
getAllResponseHeaders: function() { return ''; }
getAllResponseHeaders() { return ''; }
};

var errorThrown = 'nope!';
Expand Down
4 changes: 2 additions & 2 deletions tests/integration/adapter/serialize-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ var run = Ember.run;
var env, store, adapter, serializer;

module("integration/adapter/serialize - DS.Adapter integration test", {
beforeEach: function() {
beforeEach() {
var Person = DS.Model.extend({
name: DS.attr('string')
});
Expand All @@ -20,7 +20,7 @@ module("integration/adapter/serialize - DS.Adapter integration test", {
serializer = store.serializerFor('person');
},

afterEach: function() {
afterEach() {
run(env.container, 'destroy');
}
});
Expand Down
10 changes: 5 additions & 5 deletions tests/integration/adapter/store-adapter-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ var run = Ember.run;
var Person, Dog, env, store, adapter;

module("integration/adapter/store-adapter - DS.Store and DS.Adapter integration test", {
beforeEach: function() {
beforeEach() {
Person = DS.Model.extend({
updatedAt: DS.attr('string'),
name: DS.attr('string'),
Expand All @@ -41,7 +41,7 @@ module("integration/adapter/store-adapter - DS.Store and DS.Adapter integration
adapter = env.adapter;
},

afterEach: function() {
afterEach() {
run(env.container, 'destroy');
}
});
Expand Down Expand Up @@ -1346,7 +1346,7 @@ test("An async hasMany relationship with links should not trigger shouldBackgrou
post: Post,
comment: Comment,
adapter: DS.RESTAdapter.extend({
findRecord: function() {
findRecord() {
return {
posts: {
id: 1,
Expand All @@ -1355,7 +1355,7 @@ test("An async hasMany relationship with links should not trigger shouldBackgrou
}
};
},
findHasMany: function() {
findHasMany() {
return Ember.RSVP.resolve({
comments: [
{ id: 1, name: "FIRST" },
Expand All @@ -1364,7 +1364,7 @@ test("An async hasMany relationship with links should not trigger shouldBackgrou
]
});
},
shouldBackgroundReloadRecord: function() {
shouldBackgroundReloadRecord() {
assert.ok(false, 'shouldBackgroundReloadRecord should not be called');
}
})
Expand Down
26 changes: 13 additions & 13 deletions tests/integration/application-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function lookup(thing) {
}

module("integration/application - Injecting a Custom Store", {
beforeEach: function() {
beforeEach() {
run(function() {
app = Application.create({
StoreService: Store.extend({ isCustom: true }),
Expand All @@ -40,7 +40,7 @@ module("integration/application - Injecting a Custom Store", {
container = app.__container__;
},

afterEach: function() {
afterEach() {
run(app, app.destroy);
Ember.BOOTED = false;
}
Expand Down Expand Up @@ -69,7 +69,7 @@ test("The JSONAPIAdapter is the default adapter when no custom adapter is provid
});

module("integration/application - Injecting the Default Store", {
beforeEach: function() {
beforeEach() {
run(function() {
app = Application.create({
FooController: Controller.extend(),
Expand All @@ -81,7 +81,7 @@ module("integration/application - Injecting the Default Store", {
container = app.__container__;
},

afterEach: function() {
afterEach() {
run(app, 'destroy');
Ember.BOOTED = false;
}
Expand All @@ -106,7 +106,7 @@ test("the DS namespace should be accessible", function(assert) {

if (Ember.inject && Ember.inject.service) {
module("integration/application - Using the store as a service", {
beforeEach: function() {
beforeEach() {
run(function() {
app = Application.create({
DoodleService: Ember.Service.extend({ store: Ember.inject.service() })
Expand All @@ -116,7 +116,7 @@ if (Ember.inject && Ember.inject.service) {
container = app.__container__;
},

afterEach: function() {
afterEach() {
run(app, 'destroy');
Ember.BOOTED = false;
}
Expand All @@ -131,11 +131,11 @@ if (Ember.inject && Ember.inject.service) {
}

module("integration/application - Attaching initializer", {
beforeEach: function() {
beforeEach() {
App = Application.extend();
},

afterEach: function() {
afterEach() {
if (app) {
run(app, app.destroy);
}
Expand All @@ -148,7 +148,7 @@ test("ember-data initializer is run", function(assert) {
App.initializer({
name: "after-ember-data",
after: "ember-data",
initialize: function() { ran = true; }
initialize() { ran = true; }
});

run(function() {
Expand All @@ -167,7 +167,7 @@ test("ember-data initializer does not register the store service when it was alr
App.initializer({
name: "after-ember-data",
before: "ember-data",
initialize: function(registry) {
initialize(registry) {
registry.register('service:store', AppStore);
}
});
Expand All @@ -187,7 +187,7 @@ test("store initializer is run (DEPRECATED)", function(assert) {
App.initializer({
name: "after-store",
after: 'store',
initialize: function() { ran = true; }
initialize() { ran = true; }
});

run(function() {
Expand All @@ -202,7 +202,7 @@ test("injectStore initializer is run (DEPRECATED)", function(assert) {
App.initializer({
name: "after-store",
after: 'injectStore',
initialize: function() { ran = true; }
initialize() { ran = true; }
});

run(function() {
Expand All @@ -217,7 +217,7 @@ test("transforms initializer is run (DEPRECATED)", function(assert) {
App.initializer({
name: "after-store",
after: 'transforms',
initialize: function() { ran = true; }
initialize() { ran = true; }
});

run(function() {
Expand Down
Loading

0 comments on commit 9a57fa0

Please sign in to comment.