Skip to content

Commit

Permalink
Updated to the latest versions.
Browse files Browse the repository at this point in the history
  • Loading branch information
JT Turner committed Sep 7, 2018
1 parent 51669a7 commit 1105bf9
Show file tree
Hide file tree
Showing 8 changed files with 2,618 additions and 15 deletions.
2,573 changes: 2,573 additions & 0 deletions package-lock.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
{
"name": "bookshelf-scopes",
"version": "1.5.0",
"version": "1.5.1",
"description": "Giving you Rails like scopes in Bookshelf.js.",
"main": "src/scopes.js",
"dependencies": {
"lodash": "^3.10.1"
"lodash": "^4.17.10"
},
"devDependencies": {
"bluebird": "^2.11.0",
"bookshelf": "^0.8.2",
"chai": "^2.3.0",
"knex": "^0.8.6",
"mocha": "^2.5.3",
"sqlite3": "^3.1.8"
"bluebird": "^3.5.2",
"bookshelf": "^0.13.3",
"chai": "^4.1.2",
"knex": "^0.15.2",
"mocha": "^5.2.0",
"sqlite3": "^4.0.2"
},
"scripts": {
"test": "mocha"
Expand Down
7 changes: 6 additions & 1 deletion test/scopes_basic.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var Promise = require('bluebird');

var knex = require('knex')({
client: 'sqlite3',
connection: { filename: "./mytestdb" }
connection: { filename: "./mytestdb" },
useNullAsDefault: true
});

var bookshelf = require('bookshelf')(knex);
Expand All @@ -28,6 +29,10 @@ describe('scopes - basic scope', function() {
});
});

after(function(done) {
knex.destroy(done);
});

it('can add simple scope method with a where and fetchAll from db', function() {

var TestModel1 = bookshelf.Model.extend({
Expand Down
9 changes: 7 additions & 2 deletions test/scopes_collection.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var Promise = require('bluebird');

var knex = require('knex')({
client: 'sqlite3',
connection: { filename: "./mytestdb" }
connection: { filename: "./mytestdb" },
useNullAsDefault: true
});

var bookshelf = require('bookshelf')(knex);
Expand Down Expand Up @@ -33,6 +34,10 @@ describe('scopes - collection', function() {
});
});

after(function(done) {
knex.destroy(done);
});

it('can add simple scope method with a where and fetch from db', function() {

var TestModel1 = bookshelf.Model.extend({
Expand All @@ -49,7 +54,7 @@ describe('scopes - collection', function() {
});

expect(TestCollection1.active).to.not.be.undefined;

return TestCollection1.active().fetch().then(function(allActive) {
expect(allActive.length).to.equal(2);
expect(allActive.models[0].get('status')).to.equal('Active');
Expand Down
7 changes: 6 additions & 1 deletion test/scopes_default.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var Promise = require('bluebird');

var knex = require('knex')({
client: 'sqlite3',
connection: { filename: "./mytestdb" }
connection: { filename: "./mytestdb" },
useNullAsDefault: true
});

var bookshelf = require('bookshelf')(knex);
Expand All @@ -28,6 +29,10 @@ describe('scopes - default', function() {
});
});

after(function(done) {
knex.destroy(done);
});

it('can set default scope and fetchAll using it', function() {
var TestModel1 = bookshelf.Model.extend({
tableName: 'testmodel',
Expand Down
7 changes: 6 additions & 1 deletion test/scopes_inherit.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var Promise = require('bluebird');

var knex = require('knex')({
client: 'sqlite3',
connection: { filename: "./mytestdb" }
connection: { filename: "./mytestdb" },
useNullAsDefault: true
});

var bookshelf = require('bookshelf')(knex);
Expand All @@ -28,6 +29,10 @@ describe('scopes - inherited scope', function() {
});
});

after(function(done) {
knex.destroy(done);
});

it('can add simple scope method with a where and fetchAll from db', function() {
var TestModelBase = bookshelf.Model.extend({
scopes: {
Expand Down
7 changes: 6 additions & 1 deletion test/scopes_joining.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var Promise = require('bluebird');

var knex = require('knex')({
client: 'sqlite3',
connection: { filename: "./mytestdb" }
connection: { filename: "./mytestdb" },
useNullAsDefault: true
});

var bookshelf = require('bookshelf')(knex);
Expand Down Expand Up @@ -41,6 +42,10 @@ describe('scopes - joining scope', function() {
]);
});

after(function(done) {
knex.destroy(done);
});

it('can add scope with a basic joining where and fetchAll from db', function() {

var TestModel1 = bookshelf.Model.extend({
Expand Down
7 changes: 6 additions & 1 deletion test/scopes_related.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ var Promise = require('bluebird');

var knex = require('knex')({
client: 'sqlite3',
connection: { filename: "./mytestdb" }
connection: { filename: "./mytestdb" },
useNullAsDefault: true
});

var bookshelf = require('bookshelf')(knex);
Expand Down Expand Up @@ -53,6 +54,10 @@ describe('scopes - related scope', function() {
]);
});

after(function(done) {
knex.destroy(done);
});

it('default scope is on related data fetch', function() {

var TestModel1 = bookshelf.Model.extend({
Expand Down

0 comments on commit 1105bf9

Please sign in to comment.