bookshelf-jsonapi-params
Version:
Automatically applies relations, filters, and more from the JSON API spec to your Bookshelf.js results
40 lines (31 loc) • 996 B
JavaScript
import Bookshelf from 'bookshelf';
import Knex from 'knex';
import Sqlite3 from 'sqlite3';
import Promise from 'bluebird';
// Use Chai.expect
import Chai from 'chai';
const expect = Chai.expect;
Chai.use(expect);
describe('bookshelf-jsonapi-params with sqlite3', () => {
// Create the database
new Sqlite3.Database('./test/test.sqlite');
// Connect Bookshelf to the database
const dbConfig = {
client: 'sqlite3',
connection: {
filename: './test/test.sqlite'
}
};
const repository = Bookshelf(Knex(dbConfig));
// Create models
require('./test-helpers/common')(repository, dbConfig.client);
after((done) => {
// Drop the tables when tests are complete
Promise.join(
repository.knex.schema.dropTableIfExists('person'),
repository.knex.schema.dropTableIfExists('pet'),
repository.knex.schema.dropTableIfExists('toy')
)
.then(() => done());
});
});