Skip to content

Decouple test from the default resolver for data_adapter#15091

Merged
mixonic merged 1 commit intoemberjs:masterfrom
Gaurav0:decouple_data_adapter_test
Apr 5, 2017
Merged

Decouple test from the default resolver for data_adapter#15091
mixonic merged 1 commit intoemberjs:masterfrom
Gaurav0:decouple_data_adapter_test

Conversation

@Gaurav0
Copy link

@Gaurav0 Gaurav0 commented Mar 27, 2017

For #15058

Copy link
Member

@mixonic mixonic left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that first test can just have its description changed. A read of https://github.com/emberjs/ember.js/blob/master/packages/ember-extension-support/lib/data_adapter.js doesn't make me believe these tests are specific to the default resolver, nor do these tests.

Some small cleanup remains. Thanks @Gaurav0!

App.destroy();
init() {
this._super(...arguments);
let self = this;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe self is used here

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


QUnit.test('getRecords gets a model name as second argument', function() {
App.Post = Model.extend();
['@test Model types added with DefaultResolver']() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this test is specifically mentioning DefaultResolver. By migrating to the ApplicationTestCase and using add etc, it is no longer using the default resolver. Instead it now uses the TestResolver.

Either the test description is wrong and the data adapter doesn't require the DefaultResolver, or this test should not be ported. I''m not sure which.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing DefaultResolver from description

init() {
this._super(...arguments);
let self = this;
this.set('containerDebugAdapter', {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this property is used?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tests fail without a mock containerDebugAdapter.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misread this the first time, looks good 👍

import EmberDataAdapter from '../data_adapter';
import { Application as EmberApplication, Resolver as DefaultResolver } from 'ember-application';
import { moduleFor, ApplicationTestCase } from 'internal-test-helpers';
import { ModuleBasedResolver } from 'internal-test-helpers/test-resolver';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This import is not used.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.

@mixonic mixonic self-assigned this Apr 3, 2017
@mixonic mixonic merged commit 5e9ce4a into emberjs:master Apr 5, 2017
@mixonic
Copy link
Member

mixonic commented Apr 5, 2017

Thank you @Gaurav0!

@homu homu mentioned this pull request Apr 5, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants