Skip to content

Commit

Permalink
fix tests after removing 2.x in workspace
Browse files Browse the repository at this point in the history
  • Loading branch information
dhmlau committed May 13, 2019
1 parent 3224a73 commit ff8ffc0
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 31 deletions.
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');
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

0 comments on commit ff8ffc0

Please sign in to comment.