Why is having a computed property breaking all my tests?


I feel like I’m trying to do something really simple (test a computed property), but just having the computed property in the components breaks all my tests.

The unit test:

import {
} from 'ember-qunit';
import Ember from 'ember';

moduleForComponent('test-component', {});
test("It can solve the step", function(assert){
    var component = this.subject();

        component.set("propertyBeingObserved", "Some value");
    assert.equal(component.get("computedProperty"), "Some value observed");

And the component:

import Ember from 'ember';

export default Ember.Component.extend({
    computedProperty: Ember.computed("propertyBeingObserved", function(){
        return this.get("propertyBeingObserved") + " observed";

Depending on which variation of this code I try, I get errors ranging from needing to use Ember.set() to one telling me that I can’t have more than one root element. Sometimes it’ll even break tests in different modules. This seems pretty 101- what am I screwing up?


Solved. Holy cow, that was practically special-engineered to drive me insane.

When I typed in the above example into a fresh CLI project, it worked. So, I went back to my actual project and started comparing. The syntax was right, everything was being called in the same order, so I just copy/pasted the above example into my project… no more errors.

The actual property name in my project for propertyBeingObserved was currentState… which is apparently a system property, reserved word, or otherwise something that was not what I thought it was. Setting and getting it was producing unpredictable behavior.