mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 06:01:26 +08:00
ES6: Convert all test files over
This commit is contained in:
23
test/javascripts/models/model-test.js.es6
Normal file
23
test/javascripts/models/model-test.js.es6
Normal file
@ -0,0 +1,23 @@
|
||||
module("Discourse.Model");
|
||||
|
||||
test("mixes in Discourse.Presence", function() {
|
||||
ok(Discourse.Presence.detect(Discourse.Model.create()));
|
||||
});
|
||||
|
||||
test("extractByKey: converts a list of hashes into a hash of instances of specified class, indexed by their ids", function() {
|
||||
var firstObject = {id: "id_1", foo: "foo_1"};
|
||||
var secondObject = {id: "id_2", foo: "foo_2"};
|
||||
|
||||
var actual = Discourse.Model.extractByKey([firstObject, secondObject], Ember.Object);
|
||||
var expected = {
|
||||
id_1: Ember.Object.create(firstObject),
|
||||
id_2: Ember.Object.create(secondObject)
|
||||
};
|
||||
|
||||
ok(_.isEqual(actual, expected));
|
||||
});
|
||||
|
||||
test("extractByKey: returns an empty hash if there isn't anything to convert", function() {
|
||||
deepEqual(Discourse.Model.extractByKey(), {}, "when called without parameters");
|
||||
deepEqual(Discourse.Model.extractByKey([]), {}, "when called with an empty array");
|
||||
});
|
Reference in New Issue
Block a user