How do I test a static method on a model?


#1

I have a model:

var Foo = Ember.Object.extend({
  // ...
});

… and I have defined a so-called named constructor:

Foo.reopenClass({
  bar(baz) {
    // ...
  }
});

Now I’m trying to test Foo.bar():

import { moduleFor, test } from 'ember-qunit';

moduleFor('model:foo', 'Foo model');

test('Foo.bar() does the right thing', function (assert) {
  assert.propEqual(Foo.bar(), {});
});

But QUnit gives me the following error:

‘Foo’ is undefined

How do I expose the Foo class name so that I can call a static method?