Skip to content

Update tests to use registry for model creation [2.x] - #2782

Merged
gunjpan merged 1 commit into
2.xfrom
backport/compat_flag_cleanup
Sep 27, 2016
Merged

Update tests to use registry for model creation [2.x]#2782
gunjpan merged 1 commit into
2.xfrom
backport/compat_flag_cleanup

Conversation

@gunjpan

@gunjpangunjpan commented Sep 22, 2016

Copy link
Copy Markdown
Contributor

Current implementation of app.model(modelName, settings)
works as a sugar for model creation. From LB 3.0 onwards, this is
not supported.
This backporting:

  • keeps the sugar method for model creation for backward
    compatibility
  • updates test cases to use app.registry.createModel()
    for model creation

Backport of #2401

Connect to strongloop-internal/scrum-loopback#772

@gunjpan

Copy link
Copy Markdown
ContributorAuthor

@bajtos : Could you please review this backport PR? Thank you.

@bajtosbajtos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks mostly good, please check two comments related to remoting.errorHandler config.

Comment threadtest/acl.test.js Outdated
var beforeHookCalled = false;

app.use(loopback.rest());
app.set('remoting', { errorHandler: { debug: true, log: false }});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this errorHandler configuration was added in LB 3.x only, could you please check?

@gunjpangunjpanSep 23, 2016

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I am not sure as I see both, errorHandler & `strong-error-handler' in package.json for 2.x. Checking that.

Copy link
Copy Markdown
ContributorAuthor

Choose a reason for hiding this comment

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

I'm removing these lines as they weren't present in 2.x

Comment threadtest/app.test.js Outdated
beforeEach(function() {
app = loopback();
db = loopback.createDataSource({connector: loopback.Memory});
app.set('remoting', { errorHandler: { debug: true, log: false }});

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

ditto

@bajtosbajtos assigned gunjpan and unassigned bajtosSep 23, 2016
@gunjpan
gunjpanforce-pushed the backport/compat_flag_cleanup branch from 5d88033 to 827dd12CompareSeptember 23, 2016 19:15
@gunjpan

Copy link
Copy Markdown
ContributorAuthor

@bajtos : Addressed your comments, removed use of error handler as it's not there in 2.x. PTAL.

@bajtosbajtos left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

:shipit:

@bajtosbajtos changed the title Update tests to use registry for model creationUpdate tests to use registry for model creation [2.x]Sep 26, 2016
@superkhau

Copy link
Copy Markdown
Contributor

test please

Current implementation of `app.model(modelName, settings)`
works as a sugar for model creation. In LB 3.0, this is
not supported anymore. This backporting:
- keeps the sugar method for model creation for backward
compatibility
- updates test cases to use `app.registry.createModel()`
for model creation
Backport of #2401
@gunjpan
gunjpanforce-pushed the backport/compat_flag_cleanup branch from 827dd12 to e244153CompareSeptember 27, 2016 20:44
@gunjpan
gunjpan merged commit 7037994 into 2.xSep 27, 2016
@gunjpan
gunjpan deleted the backport/compat_flag_cleanup branch September 27, 2016 22:49
Sign up for freeto 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.

3 participants

@gunjpan@superkhau@bajtos