• Robert Knight's avatar
    Use $q rather than native Promise in `store` · cac26947
    Robert Knight authored
    Testing code that mixes native promises with $q promises (eg. as
    returned by $http methods) is a PITA in tests because in that
    environment:
    
     1. Native promises behave as usual - resolving on the next tick
    
     2. $q promises do not resolve until a digest is triggered explicitly.
    
    As a result, causing a promise pipeline involving both types of promises
    to fully execute is tricky.
    
    Sticking to `$q` promises for the moment means that
    `$httpBackend.flush()` will synchronously flush any resolved promises
    and HTTP requests.
    
    In future we can replace this crap with plain fetch() as part of
    extracting the Hypothesis API client as a separate entity from the
    client.
    cac26947
store.js 4.12 KB