Quantcast
Channel: Ember.JS - Latest topics
Viewing all articles
Browse latest Browse all 4828

How do a test promise isFulfilled in integration tests?

$
0
0

@GregWeb wrote:

Hi I’m quite new to promises and definitely promises in Ember. I’m using EMber 2.18

I have a component with the following conditional:

{{#if totalAmount.isFulfilled}}
    <p data-test-total-amount>{{numeral-format (if totalAmount.count totalAmount.count 0)}}</p>
{{/if}}

If the promise is fulfilled then a value will show and I want to test that it shows correctly, otherwise is should show zero.

SO I have this component, where uniqueInteractions is the result of an ajax request : {{ui-circle-section totalAmount=uniqueInteractions}}

And just to test that I can use a promise and have it produce a value when fulfilled I tried:

var uniqueInteractions = new Promise(function(resolve) {
  return resolve("459");
});

await this.set('uniqueInteractions', uniqueInteractions);

But, that just doesn’t work. What’s the “ember” pattern for doing this?

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4828

Trending Articles