Skip to content

Instantly share code, notes, and snippets.

@davismj
Created August 7, 2017 10:18
Show Gist options
  • Select an option

  • Save davismj/38bf9ca764213927c709cac438635c2d to your computer and use it in GitHub Desktop.

Select an option

Save davismj/38bf9ca764213927c709cac438635c2d to your computer and use it in GitHub Desktop.
DI and Unit Testing
import { Container } from 'aurelia-dependency-injection';
describe('the unit test', () => {
let container;
beforeEach() {
container = new Container();
// Off the top of my head, I'm not sure how we would create an element in jasmine. I want to say it would look something like this. Since this isn't what you're really interested in, I'm just leaving it like this for now. It's probably wrong.
container.registerInstance(Element, new Element());
}
it('should have an element in its container', () => {
let el = container.get(Element);
expect(el).toBeDefined();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment