mardi 21 juillet 2015

Testing Fluxxor Stores with Jasmine

I have a set of Jasmine tests running for my React/Flux(Fluxxor) app.

When I try to require my ApplicationStore, it doesn't properly import it. The app works correctly, so the store isn't broken, it's just that the test imports a function that, when logged, looks like this:

function (options) {
        options = options || {};
        Store.call(this);

        for (var key in spec) {
          if (key === "actions") {
            this.bindActions(spec[key]);
          } else if (key === "initialize") {
            // do nothing
          } else if (_isFunction(spec[key])) {
            this[key] = spec[key].bind(this);
          } else {
            this[key] = spec[key];
          }
        }

        if (spec.initialize) {
          spec.initialize.call(this, options);
        }
      }

I'm already calling new ApplicationStore(), but that's what I get from it.

How can I get my real store so that I can test it?

Aucun commentaire:

Enregistrer un commentaire