npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

ember-owner-test-utils

v0.1.2

Published

The default blueprint for ember-cli addons.

Downloads

9

Readme

Ember Owner Test Utils

Build Status Ember Observer Score

This is an addon that is intended to provide an easy mechanism to access and override Ember owner APIs.

Installation

ember install ember-owner-test-utils

Usage

Register

I find this is most useful for dealin with services that hit the network. It allows you to declaratively specify what a given registration is responsible for inside the test file itself.

At the top of your acceptance|integration|unit test import the register helper with the following line:

import { register } from 'ember-owner-test-utils/test-support/register';

Then from within any place that has a test context (ie inside a beforeEach or test) you may set a new registration with the following:

test('it calls foo on the foo service', function(assert){
  assert.expect(1);

  register(this, 'service:foo', Ember.Service.extend({
    foo() {
      assert.ok(true);
    }
  }));

  visit('/thing');
  click('.foo-button-that-triggers-expected-service');
});

This signature can be used in all forms of Ember tests.

Playing Make Believe

You can even use it to make a registration on a component that never existed. Like so:

// See here for more of the test:
// https://github.com/rondale-sc/ember-owner-test-utils/blob/master/tests/integration/my-component-test.js
test('allows the registration of components', function(assert) {
  assert.expect(1);

 register(this, 'template:components/my-component', hbs`<button class="do-it" {{ action 'foo' }}>GO!</button>`);

  register(this, 'component:my-component', Component.extend({
      actions: {
        foo() { assert.ok(true); }
      }
    })
  );

  this.render(hbs`{{my-component}}`);

  this.$('button').click();
});

Hat tip (🎩) to ember-route-action-helper on this one. This is very useful for testing complex interactions without needing to create unnecessary files in your addon's dummy folder.

Thanks

Special thanks to @rwjblue for help with 1.13.13 support. Was a difficult thing to track down. :beers: If you'd like to hear @cowboyd and myself talk about this in more depth you can check it out at this episode of ember weekend:

Ember Weekend: Bug Integrat