-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
18 changed files
with
363 additions
and
346 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,7 @@ | ||
/client/ | ||
/coverage/ | ||
/node_modules/ | ||
server/dropdb.js | ||
/lib/expression-language/expression-syntax-parser.js | ||
/test/ | ||
build/ | ||
client/ | ||
coverage/ | ||
node_modules/ | ||
test/ | ||
drop.js | ||
|
||
Gruntfile.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,3 +41,4 @@ out/ | |
*.zip | ||
/common/models/test | ||
package-lock.json | ||
oracle-user.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ var url = basePath + '/Employees'; | |
var models = oecloud.models; | ||
|
||
function deleteAllUsers(done) { | ||
var userModel = loopback.findModel("User"); | ||
var userModel = loopback.findModel('User'); | ||
userModel.destroyAll({}, {}, function (err) { | ||
if (err) { | ||
return done(err); | ||
|
@@ -38,7 +38,7 @@ function deleteAllUsers(done) { | |
return done(err2); | ||
} | ||
if (r2 && r2.length > 0) { | ||
return done(new Error("Error : users were not deleted")); | ||
return done(new Error('Error : users were not deleted')); | ||
} | ||
}); | ||
return done(err); | ||
|
@@ -52,7 +52,7 @@ var globalCtx = { | |
describe(chalk.blue('Audit Field Mixin Test Started'), function (done) { | ||
this.timeout(15000); | ||
before('wait for boot scripts to complete', function (done) { | ||
Customer = loopback.findModel("Customer"); | ||
Customer = loopback.findModel('Customer'); | ||
deleteAllUsers(function () { | ||
return done(); | ||
}); | ||
|
@@ -65,44 +65,42 @@ describe(chalk.blue('Audit Field Mixin Test Started'), function (done) { | |
it('t1-0 create user admin/admin with /default tenant', function (done) { | ||
var url = basePath + '/users'; | ||
api.set('Accept', 'application/json') | ||
.post(url) | ||
.send([{ username: "admin", password: "admin", email: "[email protected]" }, | ||
{ username: "evuser", password: "evuser", email: "[email protected]" }, | ||
{ username: "infyuser", password: "infyuser", email: "[email protected]" }, | ||
{ username: "bpouser", password: "bpouser", email: "[email protected]" } | ||
]) | ||
.end(function (err, response) { | ||
|
||
var result = response.body; | ||
expect(result[0].id).to.be.defined; | ||
expect(result[1].id).to.be.defined; | ||
expect(result[2].id).to.be.defined; | ||
expect(result[3].id).to.be.defined; | ||
done(); | ||
}); | ||
.post(url) | ||
.send([{ username: 'admin', password: 'admin', email: '[email protected]' }, | ||
{ username: 'evuser', password: 'evuser', email: '[email protected]' }, | ||
{ username: 'infyuser', password: 'infyuser', email: '[email protected]' }, | ||
{ username: 'bpouser', password: 'bpouser', email: '[email protected]' } | ||
]) | ||
.end(function (err, response) { | ||
var result = response.body; | ||
expect(result[0].id).to.be.defined; | ||
expect(result[1].id).to.be.defined; | ||
expect(result[2].id).to.be.defined; | ||
expect(result[3].id).to.be.defined; | ||
done(); | ||
}); | ||
}); | ||
|
||
var adminToken; | ||
it('t2 Login with admin credentials', function (done) { | ||
var url = basePath + '/users/login'; | ||
api.set('Accept', 'application/json') | ||
.post(url) | ||
.send({ username: "admin", password: "admin" }) | ||
.end(function (err, response) { | ||
var result = response.body; | ||
adminToken = result.id; | ||
expect(adminToken).to.be.defined; | ||
done(); | ||
}); | ||
.post(url) | ||
.send({ username: 'admin', password: 'admin' }) | ||
.end(function (err, response) { | ||
var result = response.body; | ||
adminToken = result.id; | ||
expect(adminToken).to.be.defined; | ||
done(); | ||
}); | ||
}); | ||
|
||
it('t3-1 clean up Customer models', function (done) { | ||
Customer.settings.mixins.SoftDeleteMixin = false; | ||
Customer.destroyAll({}, { notify: false }, function (err, results) { | ||
Customer.settings.mixins.SoftDeleteMixin = true; | ||
console.log(results); | ||
if (err) | ||
return done(err); | ||
if (err) {return done(err);} | ||
var CustomerAddress = loopback.getModel('CustomerAddress', globalCtx); | ||
CustomerAddress.destroyAll({}, { notify: false}, function (err) { | ||
return done(err); | ||
|
@@ -111,14 +109,14 @@ describe(chalk.blue('Audit Field Mixin Test Started'), function (done) { | |
}); | ||
|
||
it('t3-2 create records in Customer models', function (done) { | ||
Customer.create([{name: "Smith", age: 30, id: 1 }, {name: "Atul", age: 30, id: 2 }, {name: "John", age: 30, id: 3 }], globalCtx, function (err, r) { | ||
Customer.create([{name: 'Smith', age: 30, id: 1 }, {name: 'Atul', age: 30, id: 2 }, {name: 'John', age: 30, id: 3 }], globalCtx, function (err, r) { | ||
if (err) { | ||
return done(err); | ||
} | ||
expect(r.length).to.be.equal(3); | ||
expect(r[0]._createdBy).to.be.equal("system"); | ||
expect(r[0]._modifiedBy).to.be.equal("system"); | ||
expect(r[0]._type).to.be.equal("Customer"); | ||
expect(r[0]._createdBy).to.be.equal('system'); | ||
expect(r[0]._modifiedBy).to.be.equal('system'); | ||
expect(r[0]._type).to.be.equal('Customer'); | ||
return done(); | ||
}); | ||
}); | ||
|
@@ -128,19 +126,15 @@ describe(chalk.blue('Audit Field Mixin Test Started'), function (done) { | |
var url = basePath + '/customers?access_token=' + adminToken; | ||
api.set('Accept', 'application/json') | ||
.post(url) | ||
.send({name : "Atul" , age : 30}) | ||
.send({name: 'Atul', age: 30}) | ||
.end(function (err, response) { | ||
var result = response.body; | ||
expect(response.status).to.be.equal(200); | ||
expect(result._createdBy).to.be.equal("admin"); | ||
expect(result._modifiedBy).to.be.equal("admin"); | ||
expect(result._createdBy).to.be.equal('admin'); | ||
expect(result._modifiedBy).to.be.equal('admin'); | ||
done(); | ||
}); | ||
|
||
}); | ||
}); | ||
|
||
|
||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.