I wish to test some Ember Objects/Models which make use of a third party script for some calculations.
When I began writing these tests, I hit a problem when I started interacting with the third party scripts as they weren't loaded and I hit a bunch of undefined functions. I can get round it in this case by overriding the function in the test setup but this felt horrible.
Coming from a C# background I would normally use a mock/stub for the third party library and inject it as a depedency. During testing I would just check the mock was called correctly rather than testing the output.
I couldn't find a sensible example of this in Ember.
Would mocking the library be the most appropriate approach in Ember unit testing? and if that's the case, does anyone have a suggestion from a sensible mocking library I can use for Ember unit testing? I'm tied to an old version of Ember unfortunately for this project 1.7 (cli v 0.1.2).
Aucun commentaire:
Enregistrer un commentaire