summaryrefslogtreecommitdiffstats
path: root/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/model.filters.js
diff options
context:
space:
mode:
authorlizi <li.zi30@zte.com.cn>2017-09-28 19:16:20 +0800
committerlizi <li.zi30@zte.com.cn>2017-09-28 19:16:20 +0800
commitb2a98df1fcee69ccfbab37774a9bc3152529242f (patch)
treec50c298e0d6ee20658b386da54ae01623f5bc95a /common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/model.filters.js
parent9d0d1b611f53e3f51f8bf158bfad6eb76e84d945 (diff)
Remove the unused thirdpary code from esr-gui.
Change-Id: I9f7d7234df60c7c33abef2efff051ae433e73c8c Issue-ID: AAI-402 Signed-off-by: lizi <li.zi30@zte.com.cn>
Diffstat (limited to 'common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/model.filters.js')
-rw-r--r--common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/model.filters.js191
1 files changed, 0 insertions, 191 deletions
diff --git a/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/model.filters.js b/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/model.filters.js
deleted file mode 100644
index 5cab60d..0000000
--- a/common/src/main/webapp/usageguide/appserver/node_modules/node-restful/test/model.filters.js
+++ /dev/null
@@ -1,191 +0,0 @@
-var should = require('should'),
- request = require('supertest'),
- sinon = require('sinon');
-
-describe('Model', function() {
- var config,
- movies,
- users,
- app,
- movie1,
- movie2,
- movie3,
- user1,
- user2;
- before(function(done) {
- config = require('./fixtures/config');
- config.ready(function() {
- app = config.app;
- movies = config.movie;
- users = config.user;
- movie1 = config.movies[0];
- movie2 = config.movies[1];
- movie3 = config.movies[2];
- user1 = config.users[0];
- user2 = config.users[1];
- done();
- });
- });
- describe('filters', function() {
- it('should limit GET to 10', function(done) {
- request(app)
- .get('/api/movies?limit=10')
- .end(function(err, res) {
- res.body.length.should.equal(10);
- done();
- });
- });
- it('should limit GET to 1', function(done) {
- request(app)
- .get('/api/movies?limit=1')
- .end(function(err, res) {
- res.body.length.should.equal(1);
- done();
- });
- });
- it('should skip by 5', function(done) {
- request(app)
- .get('/api/movies?limit=1&skip=5')
- .end(function(err, res) {
- request(app)
- .get('/api/movies?limit=6')
- .end(function(err2, res2) {
- res.body[0].should.eql(res2.body[res2.body.length-1]);
- done();
- });
- });
- });
- it('should select fields', function(done) {
- request(app)
- .get('/api/movies?select=year')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- movie.should.not.have.property('title');
- movie.should.have.property('year');
- });
- done();
- });
- });
- it('should sort documents', function(done) {
- request(app)
- .get('/api/movies?sort=year')
- .end(function(err, res) {
- for(var i = 1; i < res.body.length; i++) {
- (res.body[i].year >= res.body[i-1].year).should.be.true;
- }
- done();
- });
- });
- it('should filter fields using equal', function(done) {
- request(app)
- .get('/api/movies?year=2011')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- movie.year.should.equal(2011);
- });
- done();
- });
- });
- it('should filter fields using gte', function(done) {
- request(app)
- .get('/api/movies?year__gte=2012')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- movie.year.should.be.above(2011);
- });
- done();
- });
- });
- it('should filter fields using gt', function(done) {
- request(app)
- .get('/api/movies?year__gt=2011')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- movie.year.should.be.above(2011);
- });
- done();
- });
- });
- it('should filter fields using lt', function(done) {
- request(app)
- .get('/api/movies?year__lt=2013')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- movie.year.should.be.below(2013);
- });
- done();
- });
- });
- it('should filter fields using lte', function(done) {
- request(app)
- .get('/api/movies?year__lte=2012')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- movie.year.should.be.below(2013);
- });
- done();
- });
- });
- it('should filter fields using ne', function(done) {
- request(app)
- .get('/api/movies?year__ne=2013')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- movie.year.should.not.equal(2013);
- });
- done();
- });
- });
- it('should filter fields using regex', function(done) {
- request(app)
- .get('/api/movies?title__regex=2')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- movie.title.should.containEql('2');
- });
- done();
- });
- });
- it('should filter fields using regex with options', function(done) {
- request(app)
- .get('/api/movies?title__regex=' + encodeURIComponent("/tITLE/i"))
- .end(function(err, res) {
- res.body.length.should.be.above(0);
- res.body.forEach(function(movie) {
- movie.title.toLowerCase().should.containEql('title');
- });
- done();
- });
- });
- it('should populate an objectId', function(done) {
- request(app)
- .get('/api/movies/' + movie1._id + '?populate=creator')
- .end(function(err, res) {
- res.body.creator.username.should.equal(user1.username);
- res.body.creator.pass_hash.should.equal(user1.pass_hash);
- done();
- });
- });
- it('should filter using in', function(done) {
- request(app)
- .get('/api/movies?year__in=2010,2011')
- .end(function(err, res) {
- res.body.forEach(function(movie) {
- [2010,2011].indexOf(movie.year).should.be.above(-1);
- });
- done();
- });
- });
- it('should filter using nin', function(done) {
- request(app)
- .get('/api/movies?year__nin=2012,2013,2014')
- .end(function(err, res) {
- res.body.length.should.be.above(0)
- res.body.forEach(function(movie) {
- [2012,2013,2014].indexOf(movie.year).should.equal(-1);
- });
- done();
- });
- });
- });
-});