foxhound 2.0.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/foxhound.js +2713 -2723
- package/dist/foxhound.min.js +3 -6
- package/dist/foxhound.min.js.map +1 -1
- package/package.json +2 -3
- package/source/FoxHound.js +12 -24
- package/source/Foxhound-Dialects.js +15 -0
- package/source/dialects/ALASQL/FoxHound-Dialect-ALASQL.js +9 -5
- package/source/dialects/English/FoxHound-Dialect-English.js +1 -1
- package/source/dialects/MeadowEndpoints/FoxHound-Dialect-MeadowEndpoints.js +1 -2
- package/source/dialects/MySQL/FoxHound-Dialect-MySQL.js +6 -5
- package/test/FoxHound-Dialect-ALASQL_tests.js +77 -76
- package/test/FoxHound-Dialect-English_tests.js +15 -14
- package/test/FoxHound-Dialect-MeadowEndpoints_tests.js +51 -50
- package/test/FoxHound-Dialect-MySQL_tests.js +81 -80
- package/test/FoxHound_tests.js +24 -23
package/test/FoxHound_tests.js
CHANGED
|
@@ -10,7 +10,8 @@ var Chai = require('chai');
|
|
|
10
10
|
var Expect = Chai.expect;
|
|
11
11
|
var Assert = Chai.assert;
|
|
12
12
|
|
|
13
|
-
var libFable =
|
|
13
|
+
var libFable = require('fable');
|
|
14
|
+
const _Fable = new libFable({Product:'FoxhoundTests'});
|
|
14
15
|
var libFoxHound = require('../source/FoxHound.js');
|
|
15
16
|
|
|
16
17
|
suite
|
|
@@ -35,7 +36,7 @@ suite
|
|
|
35
36
|
'initialize should build a happy little object',
|
|
36
37
|
function()
|
|
37
38
|
{
|
|
38
|
-
var testFoxHound = libFoxHound.new(
|
|
39
|
+
var testFoxHound = libFoxHound.new(_Fable);
|
|
39
40
|
Expect(testFoxHound)
|
|
40
41
|
.to.be.an('object', 'FoxHound should initialize as an object directly from the require statement.');
|
|
41
42
|
Expect(testFoxHound).to.have.a.property('uuid')
|
|
@@ -48,7 +49,7 @@ suite
|
|
|
48
49
|
'basic class parameters',
|
|
49
50
|
function()
|
|
50
51
|
{
|
|
51
|
-
var testFoxHound = libFoxHound.new(
|
|
52
|
+
var testFoxHound = libFoxHound.new(_Fable);
|
|
52
53
|
Expect(testFoxHound).to.have.a.property('parameters')
|
|
53
54
|
.that.is.a('object');
|
|
54
55
|
Expect(testFoxHound.parameters).to.have.a.property('scope')
|
|
@@ -79,7 +80,7 @@ suite
|
|
|
79
80
|
function()
|
|
80
81
|
{
|
|
81
82
|
// The default dialect is English. This one-liner is all-in.
|
|
82
|
-
Expect(libFoxHound.new(
|
|
83
|
+
Expect(libFoxHound.new(_Fable).setLogLevel().setScope('Widget').buildReadQuery().query.body)
|
|
83
84
|
.to.equal('Please give me all your Widget records. Thanks.');
|
|
84
85
|
}
|
|
85
86
|
);
|
|
@@ -88,7 +89,7 @@ suite
|
|
|
88
89
|
'change the dialect',
|
|
89
90
|
function()
|
|
90
91
|
{
|
|
91
|
-
var tmpQuery = libFoxHound.new(
|
|
92
|
+
var tmpQuery = libFoxHound.new(_Fable).setLogLevel(5);
|
|
92
93
|
|
|
93
94
|
// Give a scope for the data to come from
|
|
94
95
|
tmpQuery.setScope('Widget');
|
|
@@ -141,7 +142,7 @@ suite
|
|
|
141
142
|
'change the scope by function',
|
|
142
143
|
function()
|
|
143
144
|
{
|
|
144
|
-
var tmpQuery = libFoxHound.new(
|
|
145
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
145
146
|
|
|
146
147
|
Expect(tmpQuery.parameters.scope)
|
|
147
148
|
.to.equal(false);
|
|
@@ -157,7 +158,7 @@ suite
|
|
|
157
158
|
'merge parameters',
|
|
158
159
|
function()
|
|
159
160
|
{
|
|
160
|
-
var tmpQuery = libFoxHound.new(
|
|
161
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
161
162
|
|
|
162
163
|
Expect(tmpQuery.parameters.scope)
|
|
163
164
|
.to.equal(false);
|
|
@@ -174,7 +175,7 @@ suite
|
|
|
174
175
|
function()
|
|
175
176
|
{
|
|
176
177
|
// Create a query
|
|
177
|
-
var tmpQuery = libFoxHound.new(
|
|
178
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
178
179
|
Expect(tmpQuery.parameters.scope).to.equal(false);
|
|
179
180
|
|
|
180
181
|
// Clone it
|
|
@@ -202,7 +203,7 @@ suite
|
|
|
202
203
|
'fail to change the scope by function',
|
|
203
204
|
function()
|
|
204
205
|
{
|
|
205
|
-
var tmpQuery = libFoxHound.new(
|
|
206
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
206
207
|
|
|
207
208
|
Expect(tmpQuery.parameters.scope)
|
|
208
209
|
.to.equal(false);
|
|
@@ -219,7 +220,7 @@ suite
|
|
|
219
220
|
'change the cap by function',
|
|
220
221
|
function()
|
|
221
222
|
{
|
|
222
|
-
var tmpQuery = libFoxHound.new(
|
|
223
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
223
224
|
|
|
224
225
|
Expect(tmpQuery.parameters.cap)
|
|
225
226
|
.to.equal(false);
|
|
@@ -235,7 +236,7 @@ suite
|
|
|
235
236
|
'fail to change the cap by function',
|
|
236
237
|
function()
|
|
237
238
|
{
|
|
238
|
-
var tmpQuery = libFoxHound.new(
|
|
239
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
239
240
|
|
|
240
241
|
Expect(tmpQuery.parameters.cap)
|
|
241
242
|
.to.equal(false);
|
|
@@ -251,7 +252,7 @@ suite
|
|
|
251
252
|
'change the user ID',
|
|
252
253
|
function()
|
|
253
254
|
{
|
|
254
|
-
var tmpQuery = libFoxHound.new(
|
|
255
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
255
256
|
|
|
256
257
|
Expect(tmpQuery.parameters.userID)
|
|
257
258
|
.to.equal(0);
|
|
@@ -269,7 +270,7 @@ suite
|
|
|
269
270
|
'fail to change the user ID',
|
|
270
271
|
function()
|
|
271
272
|
{
|
|
272
|
-
var tmpQuery = libFoxHound.new(
|
|
273
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
273
274
|
|
|
274
275
|
Expect(tmpQuery.parameters.userID)
|
|
275
276
|
.to.equal(0);
|
|
@@ -286,7 +287,7 @@ suite
|
|
|
286
287
|
'change the begin by function',
|
|
287
288
|
function()
|
|
288
289
|
{
|
|
289
|
-
var tmpQuery = libFoxHound.new(
|
|
290
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
290
291
|
|
|
291
292
|
Expect(tmpQuery.parameters.begin)
|
|
292
293
|
.to.equal(false);
|
|
@@ -302,7 +303,7 @@ suite
|
|
|
302
303
|
'fail to change the begin by function',
|
|
303
304
|
function()
|
|
304
305
|
{
|
|
305
|
-
var tmpQuery = libFoxHound.new(
|
|
306
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
306
307
|
|
|
307
308
|
Expect(tmpQuery.parameters.begin)
|
|
308
309
|
.to.equal(false);
|
|
@@ -318,7 +319,7 @@ suite
|
|
|
318
319
|
'Manually set the parameters object',
|
|
319
320
|
function()
|
|
320
321
|
{
|
|
321
|
-
var tmpQuery = libFoxHound.new(
|
|
322
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
322
323
|
|
|
323
324
|
tmpQuery.parameters = {Frogs:'YES'};
|
|
324
325
|
|
|
@@ -331,7 +332,7 @@ suite
|
|
|
331
332
|
'Manually set the query object',
|
|
332
333
|
function()
|
|
333
334
|
{
|
|
334
|
-
var tmpQuery = libFoxHound.new(
|
|
335
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
335
336
|
|
|
336
337
|
tmpQuery.query = {body:'GET TO ALL DE CHOPPA RECORDS'};
|
|
337
338
|
|
|
@@ -344,7 +345,7 @@ suite
|
|
|
344
345
|
'Manually set the result object',
|
|
345
346
|
function()
|
|
346
347
|
{
|
|
347
|
-
var tmpQuery = libFoxHound.new(
|
|
348
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
348
349
|
|
|
349
350
|
tmpQuery.result = {executed:true, value:[{Name:'Wendy'},{Name:'Griffin'}]};
|
|
350
351
|
|
|
@@ -357,7 +358,7 @@ suite
|
|
|
357
358
|
'Set a bad dialect',
|
|
358
359
|
function()
|
|
359
360
|
{
|
|
360
|
-
var tmpQuery = libFoxHound.new(
|
|
361
|
+
var tmpQuery = libFoxHound.new(_Fable).setDialect('Esperanto');
|
|
361
362
|
Expect(tmpQuery.dialect.name)
|
|
362
363
|
.to.equal('English');
|
|
363
364
|
}
|
|
@@ -367,7 +368,7 @@ suite
|
|
|
367
368
|
'Try to pass bad filters',
|
|
368
369
|
function()
|
|
369
370
|
{
|
|
370
|
-
var tmpQuery = libFoxHound.new(
|
|
371
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
371
372
|
tmpQuery.addFilter();
|
|
372
373
|
tmpQuery.addFilter('Name');
|
|
373
374
|
Expect(tmpQuery.parameters.filter)
|
|
@@ -379,7 +380,7 @@ suite
|
|
|
379
380
|
'Pass many filters',
|
|
380
381
|
function()
|
|
381
382
|
{
|
|
382
|
-
var tmpQuery = libFoxHound.new(
|
|
383
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
383
384
|
tmpQuery.addFilter('Name', 'Smith');
|
|
384
385
|
tmpQuery.addFilter('City', 'Seattle');
|
|
385
386
|
Expect(tmpQuery.parameters.filter.length)
|
|
@@ -393,7 +394,7 @@ suite
|
|
|
393
394
|
'Pass bad records',
|
|
394
395
|
function()
|
|
395
396
|
{
|
|
396
|
-
var tmpQuery = libFoxHound.new(
|
|
397
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
397
398
|
tmpQuery.addRecord();
|
|
398
399
|
Expect(tmpQuery.query.records)
|
|
399
400
|
.to.equal(false); }
|
|
@@ -403,7 +404,7 @@ suite
|
|
|
403
404
|
'Pass multiple records',
|
|
404
405
|
function()
|
|
405
406
|
{
|
|
406
|
-
var tmpQuery = libFoxHound.new(
|
|
407
|
+
var tmpQuery = libFoxHound.new(_Fable);
|
|
407
408
|
tmpQuery.addRecord({ID:10});
|
|
408
409
|
tmpQuery.addRecord({ID:100});
|
|
409
410
|
tmpQuery.addRecord({ID:1000});
|