Skip to content

Commit 8c553e7

Browse files
committed
improving coverage
1 parent c332870 commit 8c553e7

File tree

6 files changed

+43
-10
lines changed

6 files changed

+43
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[![jSQL Logo](http://i.imgur.com/VQlJKOc.png)](http://pamblam.github.io/jSQL/)
22

3-
jSQL (Official) - Version 3.0.0 - *Now available without a prescription!*
3+
jSQL (Official) - Version 3.0.1 - *Now available without a prescription!*
44

55
[![npm version](https://badge.fury.io/js/jsql-official.svg)](https://badge.fury.io/js/jsql-official) [![Build Status](https://travis-ci.org/Pamblam/jSQL.svg?branch=master)](https://travis-ci.org/Pamblam/jSQL) [![Inline docs](http://inch-ci.org/github/Pamblam/jSQL.svg?branch=master)](https://github.com/Pamblam/jSQL/wiki) [![Code Climate](https://codeclimate.com/github/Pamblam/jSQL/badges/gpa.svg)](https://codeclimate.com/github/Pamblam/jSQL) [![Coverage Status](https://coveralls.io/repos/github/Pamblam/jSQL/badge.svg?branch=master)](https://coveralls.io/github/Pamblam/jSQL?branch=master)
66

jSQL.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* jsql-official - v3.0.0
2+
* jsql-official - v3.0.1
33
* A persistent SQL database.
44
* @author Rob Parham
55
* @website http://pamblam.github.io/jSQL/
@@ -2707,7 +2707,7 @@ function removeQuotes(str){
27072707
}
27082708

27092709
return {
2710-
version: "3.0.0",
2710+
version: "3.0.1",
27112711
tables: {},
27122712
query: jSQLParseQuery,
27132713
createTable: createTable,

jSQL.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "jsql-official",
3-
"version": "3.0.0",
3+
"version": "3.0.1",
44
"description": "A persistent SQL database.",
55
"main": "jSQL.min.js",
66
"directories": {

test/test1.js

Lines changed: 35 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,21 @@ jSQL.load(function () {
3434
expect(!!jSQL.tables.keytest3).to.be.true;
3535
});
3636

37+
it('insert into keytest3 table', function(){
38+
jSQL.query("insert ignore into keytest3 (name, num1, num2) values (?, ?, ?)").execute(['bob', 3, 5]);
39+
expect(jSQL.tables.keytest3.data.length === 1).to.be.true;
40+
});
41+
42+
it('insert into keytest3 table', function(){
43+
jSQL.query("insert ignore into keytest3 (name, num1, num2) values (?, ?, ?)").execute(['bill', 3, 5]);
44+
expect(jSQL.tables.keytest3.data.length === 1).to.be.true;
45+
});
46+
47+
it('insert into keytest3 table', function(){
48+
jSQL.query("insert ignore into keytest3 (name, num1, num2) values (?, ?, ?)").execute(['bill', 3, 7]);
49+
expect(jSQL.tables.keytest3.data.length === 2).to.be.true;
50+
});
51+
3752
it('create smalltest table', function(){
3853
jSQL.query("create table `smalltest` (id int, str varchar)").execute();
3954
expect((!!jSQL.tables.smalltest)).to.be.true;
@@ -150,12 +165,14 @@ jSQL.load(function () {
150165
});
151166

152167
it("should create a table with a bunch of numbers", function(){
153-
jSQL.query(`CREATE TABLE IF NOT EXISTS nmbrs (
168+
var sql = jSQL.minify(`CREATE TABLE IF NOT EXISTS nmbrs (
154169
numba1 tinyint(3),
155170
numba2 smallint(3),
156171
numba3 mediumint(3),
157172
numba4 bigint(3)
158-
)`).execute();
173+
)`);
174+
175+
jSQL.query(sql).execute();
159176
expect((jSQL.tables.nmbrs !== undefined)).to.be.true;
160177
});
161178

@@ -169,5 +186,21 @@ jSQL.load(function () {
169186
expect((r[0] === 3)).to.be.true;
170187
});
171188

189+
190+
it("should create a table with a function", function(){
191+
jSQL.query(`CREATE TABLE IF NOT EXISTS fff (fff)`).execute();
192+
expect((jSQL.tables.fff !== undefined)).to.be.true;
193+
});
194+
195+
it("should insert into a table with a function", function(){
196+
jSQL.query(`insert into fff values (?)`).execute([function(){return "poop"}]);
197+
expect((jSQL.tables.fff !== undefined)).to.be.true;
198+
});
199+
200+
it("should select from a table with a function", function(){
201+
var r = jSQL.query(`select * from fff`).execute().fetch("ARRAY");
202+
expect((r[0]() === "poop")).to.be.true;
203+
});
204+
172205
});
173206
});

test/test2.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jSQL.load(function () {
1919
});
2020

2121
it('dynamically adding columns', function(){
22-
jSQL.createTable("aTable", ["a", "b", "c"]).execute([
22+
jSQL.createTable("aTable", ["u0", "b", "c"]).execute([
2323
[12, 34, 56, 78],
2424
[23, 45, 67, 89, 78, 78],
2525
[7]
@@ -28,7 +28,7 @@ jSQL.load(function () {
2828
});
2929

3030
it('mixing arrays and objects', function(){
31-
jSQL.createTable("ceTable", ['a', 'b', 'c', 'd', 'e', 'f', 'g']).execute([
31+
jSQL.createTable("ceTable", ['u0', 'b', 'c', 'd', 'e', 'f', 'g']).execute([
3232
[12, 34, 56, 78],
3333
[23, 45, 67, 89, 78, 78],
3434
[7], {"a": 1, "b": 2, "g": 3}

0 commit comments

Comments
 (0)