Skip to content

Commit

Permalink
test fix - code review
Browse files Browse the repository at this point in the history
  • Loading branch information
rashmihunt committed Aug 21, 2017
1 parent a140ebe commit dba4a26
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions test/specgen/swagger-spec-generator.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -447,7 +447,8 @@ describe('swagger definition', function() {
.to.include.members(['Product']);
});

it('should use $new_Product definition for post/create operation', function() {
it('should use $new_Product definition for post/create operation when ' +
'forceId is in effect', function() {
var app = createLoopbackAppWithModel();
var swaggerResource = createSwaggerObject(app);
// Post(create) operation should reference $new_Product
Expand All @@ -458,7 +459,8 @@ describe('swagger definition', function() {
.to.equal('#/definitions/Product');
});

it('should use Product swagger definition for all operations', function() {
it('should use Product swagger definition for all operations when ' +
'forceId is false', function() {
const options = {
forceId: false,
};
Expand All @@ -477,11 +479,9 @@ describe('swagger definition', function() {

app.dataSource('db', {connector: 'memory'});

var modelSettings;
if (options === undefined || options.forceId === undefined) {
modelSettings = {description: ['a-description', 'line2']};
} else {
modelSettings = {description: ['a-description', 'line2'], forceId: options.forceId};
const modelSettings = {description: ['a-description', 'line2']};
if (options && options.forceId !== undefined) {
modelSettings.forceId = options.forceId;
}

var Product = loopback.createModel('Product', {
Expand Down

0 comments on commit dba4a26

Please sign in to comment.