Допустим, у меня есть такой код:
...
$scope.articles = [{id: 1}, {id: 2}];
$scope.openArticle = (artId) => {
...
const article = ...;
$http.post(`url`, `body`).then(() => {
article.opened = true;
}, () => {});
};
Есть ли способ проверить это с помощью jasmine
?
, например, я пытаюсь так:
...
it('should open article', () => {
expect($scope.articles).toBeDefined();
$scope.toggleFeature(1);
expect($scope.articles[0].opened).toBe(true);
});
...
but sure, it won't work this way - I have a promisse inside
I can't change my code to return anything...
so: is it possible to test such function somehow?