ember-changeset: Underlying object for changeset is missing...
(…but it’s not)
Version
ember-cli: 3.17.0 ember-changeset: 3.3.1 ember-cli-typescript: 3.1.3
Test Case
given: a component that expects a changeset as a property
import { module, test } from 'qunit'
import { setupRenderingTest } from 'ember-qunit'
import { render } from '@ember/test-helpers'
import { hbs } from 'ember-cli-htmlbars'
import Changeset from 'ember-changeset'
module('Integration | Component | my-component', function(hooks) {
setupRenderingTest(hooks)
test('it renders', async function(assert) {
const obj = { bob: 'tom' }
assert.ok(Boolean(obj), 'This should be true') // <- this, the same assert from the library, passes
// @ts-ignore
this.set('changeset', new Changeset(obj)) // <- this bombs with the above error
// ...remainder of test ellided...
})
})
(this is in a closed-source project; I can’t provide a link to the repo, but I can provide more information if you’d like)
Steps to reproduce
npx ember test
Expected Behavior
The test should continue, and render the component using the changeset.
Actual Behavior
The test fails on the indicated line above, with the error Error: Assertion Failed. Underlying object for changeset is missing
.
It may be significant (or not) that the result is the same whether the file ends with .js
or .ts
; this doesn’t appear (to me) to be an Ember TypeScript edge case.
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 2
- Comments: 18
I haven’t forgotten about this; it’ll likely be early next week.
👋 Can you try the function approach? I don’t think it should matter so I’m a bit confused atm.