Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix tests after removing 2.x in workspace #405

Merged
merged 1 commit into from
May 13, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,6 @@ module.exports = class AppGenerator extends ActionsMixin(yeoman) {
type: Boolean,
});

this.option('loopbackVersion', {
desc: g.f('Select the LoopBack version'),
type: String,
});

this.option('template', {
desc: g.f('Set up the LoopBack application template'),
type: String,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"loopback-bluemix": "^3.0.0",
"loopback-soap": "^1.0.0",
"loopback-swagger": "^5.4.0",
"loopback-workspace": "^4.0.0",
"loopback-workspace": "^5.0.0",
"mkdirp": "^0.5.1",
"opn": "^5.3.0",
"ora": "^1.3.0",
Expand Down
19 changes: 1 addition & 18 deletions test/app.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ describe('loopback:app generator', function() {
}).catch(function(err) {
expect(err.message).to.eql(
'Invalid LoopBack version: invalid-version. ' +
'Available versions are 3.x, 2.x.'
'Available versions are 3.x.'
);
ctx.generator.emit('end');
});
Expand All @@ -250,23 +250,6 @@ describe('loopback:app generator', function() {
});
});

it('scaffolds 2.x app when option.loopbackVersion is 2.x',
function() {
return helpers.run(path.join(__dirname, '../app'))
.cd(SANDBOX)
.withPrompts({
name: 'test-app',
template: 'api-server',
loopbackVersion: '2.x',
})
.then(function() {
// generator calls `chdir` on change of the destination root
process.chdir(SANDBOX);
var pkg = common.readJsonSync('package.json', {});
expect(semver.gtr('3.0.0', pkg.dependencies.loopback)).to.equal(true);
});
});

it('exports workspace version', () => {
const mainProps = Object.assign({}, require('../'));
expect(mainProps).to.have.property('workspaceVersion',
Expand Down
1 change: 0 additions & 1 deletion test/fixtures/help-texts/loopback_app_help.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ Options:
--force-install # Fail on install dependencies error Default: false
--skip-next-steps # Do not print "next steps" info
--explorer # Add Loopback Explorer to the project (true by default)
--loopbackVersion # Select the LoopBack version
--template # Set up the LoopBack application template
--bluemix # Set up as a Bluemix app

Expand Down
9 changes: 3 additions & 6 deletions test/remote-method.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,14 @@ describe('loopback:remote-method generator', function() {
var methods = definition.methods || {};
expect(methods).to.have.property('myRemote');
expect(methods.myRemote).to.eql({
isStatic: true,
accepts: [],
returns: [],
http: [],
});
});
});

it('method name with `prototype.` should be removed', function() {
it('method name with `prototype.` should not be removed', function() {
return helpers.run(path.join(__dirname, '../remote-method'))
.cd(SANDBOX)
.withPrompts({
Expand All @@ -74,10 +73,8 @@ describe('loopback:remote-method generator', function() {
}).then(function() {
var definition = common.readJsonSync('common/models/car.json');
var methods = definition.methods || {};
expect(methods).to.have.property('myRemote');
Copy link
Member Author

Choose a reason for hiding this comment

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

Reading from this docs page: https://loopback.io/doc/en/lb3/3.0-Release-Notes.html#name-indicates-whether-method-is-static, I think this line and the line below are no longer true. But I'm not 100% sure.
@bajtos @jannyHou @hacksparrow, I'd like to get your inputs on this. If this is true, perhaps we need to change the test name as well.

Test name method name with 'prototype.' should be removed -> method name with 'prototype.' should not removed?

Copy link
Member

Choose a reason for hiding this comment

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

Your fix looks correct to me 👍 I agree to update the test name to match the actual assertions.

Copy link
Contributor

Choose a reason for hiding this comment

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

@dhmlau Fair enough 💯

expect(methods).to.not.have.property('prototype.myRemote');
expect(methods.myRemote).to.eql({
isStatic: false,
expect(methods).to.have.property('prototype.myRemote');
expect(methods['prototype.myRemote']).to.eql({
accepts: [],
returns: [],
http: [],
Expand Down