Skip to content

Commit

Permalink
Changelog 1.0.3 :
Browse files Browse the repository at this point in the history
- update unit test
- update package
  • Loading branch information
aalfiann committed Nov 3, 2019
1 parent b5f5548 commit de3d04c
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 22 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"name": "fly-json-db",
"version": "1.0.2",
"version": "1.0.3",
"description": "NoSQL Embedded Database on top json and stream for NodeJS",
"main": "src/flyjsonstream.js",
"main": "src/flyjsondb.js",
"directories": {
"test": "test"
},
Expand Down
4 changes: 2 additions & 2 deletions src/flyjsonstream.js → src/flyjsondb.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const es = require('event-stream');
const jsonStream = require('JSONStream');
const fs = require('fs');

class FlyJsonStream {
class FlyJsonDb {

constructor() {
this._odm = new FlyJsonOdm();
Expand Down Expand Up @@ -235,4 +235,4 @@ class FlyJsonStream {
}
}

module.exports = FlyJsonStream;
module.exports = FlyJsonDb;
5 changes: 2 additions & 3 deletions test/failure.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
const assert = require('assert');
const FJS = require('../src/flyjsonstream');
const path = require('path');
const DB = require('../src/flyjsondb');

describe('Intentional failure test', function() {

it('drop with wrong file path', function() {
var nosql = new FJS();
var nosql = new DB();
nosql.drop('test/fixtures/saved.nosqls',function(err,data) {
assert.notEqual(err,null);
});
Expand Down
11 changes: 5 additions & 6 deletions test/queryfromarray.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const assert = require('assert');
const FJS = require('../src/flyjsonstream');
const path = require('path');
const DB = require('../src/flyjsondb');

describe('Query from array test', function() {

Expand All @@ -19,7 +18,7 @@ describe('Query from array test', function() {
]

it('read array', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadArray(data1,function(err,data) {
if(err) return console.log(err);
assert.deepEqual(nosql.odm.exec(),[ { user_id: 1, name: 'budi', age: 10 },
Expand All @@ -30,7 +29,7 @@ describe('Query from array test', function() {
});

it('read array promise way', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadArray(data1).then(data => {
assert.deepEqual(nosql.odm.exec(),[ { user_id: 1, name: 'budi', age: 10 },
{ user_id: 5, name: 'wawan', age: 20 },
Expand All @@ -40,7 +39,7 @@ describe('Query from array test', function() {
});

it('read array + join merge', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadArray(data1,function(err,data) {
if(err) return console.log(err);
nosql.joinArray(data2,'profile',function(err,data) {
Expand All @@ -54,7 +53,7 @@ describe('Query from array test', function() {
});

it('read array + join merge promise way', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadArray(data1).then(data => {
nosql.joinArray(data2,'profile').then(data => {
var result = nosql.odm.merge('user_id','id').exec();
Expand Down
18 changes: 9 additions & 9 deletions test/queryfromfile.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
const assert = require('assert');
const FJS = require('../src/flyjsonstream');
const DB = require('../src/flyjsondb');
const path = require('path');

describe('Query from file test', function() {

it('read file', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadFile(path.join('test/fixtures/data1.nosql'),function(err,data) {
if(err) return console.log(err);
assert.deepEqual(nosql.odm.exec(),[ { user_id: 1, name: 'budi', age: 10 },
Expand All @@ -16,7 +16,7 @@ describe('Query from file test', function() {
});

it('read file promise way', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadFile(path.join('test/fixtures/data1.nosql')).then(data => {
assert.deepEqual(nosql.odm.exec(),[ { user_id: 1, name: 'budi', age: 10 },
{ user_id: 5, name: 'wawan', age: 20 },
Expand All @@ -26,7 +26,7 @@ describe('Query from file test', function() {
});

it('read file + join merge', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadFile(path.join('test/fixtures/data1.nosql'),function(err,data) {
if(err) return console.log(err);
nosql.joinFile('test/fixtures/data2.nosql','profile',function(err,data) {
Expand All @@ -40,7 +40,7 @@ describe('Query from file test', function() {
});

it('read file + join merge promise way', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadFile(path.join('test/fixtures/data1.nosql')).then(data => {
nosql.joinFile('test/fixtures/data2.nosql','profile').then(data => {
var result = nosql.odm.merge('user_id','id').exec();
Expand All @@ -52,7 +52,7 @@ describe('Query from file test', function() {
});

it('read file + join merge + save', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadFile(path.join('test/fixtures/data1.nosql'),function(err,data) {
if(err) return console.log(err);
nosql.joinFile('test/fixtures/data2.nosql','profile',function(err,data) {
Expand All @@ -68,7 +68,7 @@ describe('Query from file test', function() {
});

it('read file + join merge + save promise way', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.loadFile(path.join('test/fixtures/data1.nosql')).then(data => {
nosql.joinFile('test/fixtures/data2.nosql','profile').then(data => {
nosql.odm.merge('user_id','id').exec();
Expand All @@ -81,7 +81,7 @@ describe('Query from file test', function() {
});

it('cleanup saved file', function(done) {
var nosql = new FJS();
var nosql = new DB();
nosql.drop('test/fixtures/saved.nosql',function(err,data) {
if(err) return console.log(err);
assert.equal(data.status,true);
Expand All @@ -90,7 +90,7 @@ describe('Query from file test', function() {
});

it('cleanup saved file with no callback', function() {
var nosql = new FJS();
var nosql = new DB();
nosql.drop('test/fixtures/saved_promise.nosql');
});

Expand Down

0 comments on commit de3d04c

Please sign in to comment.