Skip to content

Commit

Permalink
test: verify property observer is removed on unsubscribe
Browse files Browse the repository at this point in the history
  • Loading branch information
alexlafroscia committed Feb 7, 2019
1 parent 13fa198 commit d7bd126
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/unit/observables/from-property-change-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,21 @@ module("Unit | Observables | fromPropertyChange", function(hooks) {
"Not called for the second change"
);
});

test("it removed the property observer when unsubscribing", function(assert) {
const instance = Dummy.create();
const removeObserver = td.replace(instance, "removeObserver");

const observer = td.function();
const subscription = fromPropertyChange(instance, "foo").subscribe(
observer
);

subscription.unsubscribe();

assert.verify(
removeObserver("foo", instance, td.matchers.isA(Function)),
"Removes the property observer when unsubscribing"
);
});
});

0 comments on commit d7bd126

Please sign in to comment.