I am consistently getting an error while trying to resolve a promise from aurelia-breeze in a test method for an aurelia(typescript + breeze) application.
Testing framework used is karma+jasmine
.
Version of the aurelia-breeze
package is 1.0.0
Aurelia breeze makes use of es promise resolver instead of Q.js, but the test method is searching for Q.js to resolve the promise returned from breeze.
I have tried to add the Q
library to the window
object from the spec
file. But the breeze.debug.js
is trying to access the Q
js from the window
object before it is set in the spec
file.
this didn't resolve the issue.
Please help me to solve this issue.
Something like this should work:
import {configure as configureAureliaBreeze} from 'aurelia-breeze/index';
import {Container} from 'aurelia-dependency-injection';
const container = new Container();
configureAureliaBreeze({ container, globalResources: () => {} });
// ... tests ...
Breeze depends on Q for promises and jQuery for ajax. Aurelia-breeze shims both of those dependencies with ES6 promises and the aurelia http-client respectively. The code above effectively simulates what would happen in a .plugin('aurelia-breeze')
call when running your aurelia application.
https://github.com/jdanyow/aurelia-breeze/blob/master/src/index.js#L15-L16
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With