Skip to content

Commit

Permalink
some open/close/delete database test fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Christopher J. Brody committed Oct 11, 2018
1 parent 019d6a6 commit 8b981a9
Showing 1 changed file with 42 additions and 24 deletions.
66 changes: 42 additions & 24 deletions spec/www/spec/db-open-close-delete-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -147,7 +147,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -211,7 +211,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -255,7 +255,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -295,7 +295,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -333,7 +333,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -371,7 +371,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -436,7 +436,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -496,7 +496,7 @@ var mytests = function() {
expect(rs.rows.length).toBe(1);
expect(rs.rows.item(0).name).toBe('main');
expect(rs.rows.item(0).file).toBeDefined();
expect(rs.rows.item(0).file.indexOf(dbName)).not.toBe(-1);
expect(rs.rows.item(0).file.indexOf(dbName) !== -1).toBe(true);

// Close & finish:
db.close(done, done);
Expand Down Expand Up @@ -531,6 +531,9 @@ var mytests = function() {
});
}

describe('Web SQL vs plugin openDatabase test(s)', function() {

if (true) {

it('Open plugin database with Web SQL parameters (REJECTED with exception)', function(done) {
try {
Expand Down Expand Up @@ -575,7 +578,10 @@ var mytests = function() {
}
}, MYTIMEOUT);

if (window.hasWebKitWebSQL)
}

if (window.hasWebKitWebSQL) {

it('Web SQL check that db name is really a string', function(done) {
var p1 = { name: 'my.db.name', location: 'default' };
try {
Expand All @@ -596,9 +602,13 @@ var mytests = function() {
}
}, MYTIMEOUT);

for (var i=0; i<pluginScenarioCount; ++i) {
}

describe(pluginScenarioList[i] + ': open database location parameter test(s)', function() {
});

describe('Plugin: open database location parameter test(s)', function() {

if (true) {

var suiteName = 'Plugin: ';

Expand Down Expand Up @@ -891,9 +901,9 @@ var mytests = function() {
}
}, MYTIMEOUT);

});
}

}
});

});

Expand All @@ -902,8 +912,12 @@ var mytests = function() {
// TBD skip plugin test on browser platform (not yet supported):
if (isBrowser) return;

if (true) {

var suiteName = 'plugin: ';

if (true) {

it(suiteName + 'check that sqlitePlugin.deleteDatabase db name is really a string', function(done) {
var p1 = { name: 'my.db.name', location: 1 };
try {
Expand Down Expand Up @@ -1127,9 +1141,13 @@ var mytests = function() {
}
}, MYTIMEOUT);

}

}

});

describe('Plugin: db open-close-delete test(s)', function() {
describe('Plugin: db open-close-delete operation behavior test(s)', function() {
// TBD skip plugin test on browser platform (not yet supported):
if (isBrowser) return;

Expand Down Expand Up @@ -1379,7 +1397,7 @@ var mytests = function() {

test_it(suiteName + ' database.close (immediately after open) calls its success callback', function () {
// TBD POSSIBLY BROKEN on iOS/macOS due to current background processing implementation:
if (!isAndroid && !isWindows) pending('CURRENTLY BROKEN on iOS/macOS (background processing implementation)');
if (isAppleMobileOS || isMac) pending('TBD POSSIBLY BROKEN on iOS/macOS (background processing implementation)');

// asynch test coming up
stop(1);
Expand Down Expand Up @@ -1582,7 +1600,7 @@ var mytests = function() {
window.sqlitePlugin.deleteDatabase(first, second, third);
}

// Needed to support some large-scale applications:
// (Was needed to test support for an enterprise application)
test_it(suiteName + ' open same database twice in [same] specified location works', function () {
// XXX TODO [BROKEN]: same db name, different location should be different db!
stop(2);
Expand Down Expand Up @@ -1620,7 +1638,7 @@ var mytests = function() {
});
});

// Needed to support some large-scale applications:
// (Was needed to test support for an enterprise application)
test_it(suiteName + ' close then re-open (2x) allows subsequent queries to run', function () {
// asynch test coming up
stop(1);
Expand Down Expand Up @@ -1671,7 +1689,7 @@ var mytests = function() {
});
});

// Needed to support some large-scale applications:
// (Was needed to test support for an enterprise application)
test_it(suiteName + " delete then re-open (location: 'default') allows subsequent queries to run", function () {
var dbName = "test-database-delete-and-reopen.db";
var dbargs = {name: dbName, iosDatabaseLocation: 'default'};
Expand Down Expand Up @@ -1713,9 +1731,9 @@ var mytests = function() {
});

// XXX SEE BELOW: repeat scenario but wait for open callback before close/delete/reopen
// Needed to support some large-scale applications:
// (Was needed to test support for an enterprise application)
test_it(suiteName + ' immediate close, then delete then re-open allows subsequent queries to run', function () {
if (!isAndroid && !isWindows) pending('CURRENTLY BROKEN on iOS/macOS (background processing implementation)');
if (isAppleMobileOS || isMac) pending('CURRENTLY BROKEN on iOS/macOS (background processing implementation)');

var dbName = "Immediate-close-delete-Reopen.db";
var dbargs = {name: dbName, location: 'default'};
Expand Down Expand Up @@ -1862,7 +1880,7 @@ var mytests = function() {

test_it(suiteName + ' repeatedly open and close database faster (5x)', function () {
// TBD CURRENTLY BROKEN on iOS/macOS due to current background processing implementation:
if (!isAndroid && !isWindows) pending('CURRENTLY BROKEN on iOS/macOS (background processing implementation)');
if (isAppleMobileOS || isMac) pending('CURRENTLY BROKEN on iOS/macOS (background processing implementation)');
// TBD ???:
if (isAndroid && isImpl2) pending('FAILS on builtin android.database implementation (androidDatabaseImplementation: 2)');

Expand Down Expand Up @@ -1920,7 +1938,7 @@ var mytests = function() {
});
});

// Needed to support some large-scale applications:
// (Was needed to test support for an enterprise application)
test_it(suiteName + ' repeatedly open and delete database (4x)', function () {
var dbName = 'test-repeatedly-open-and-delete-4x.db';
var dbargs = {name: dbName, iosDatabaseLocation: 'Documents'};
Expand Down Expand Up @@ -1983,7 +2001,7 @@ var mytests = function() {
});
});

// Needed to support some large-scale applications:
// (Was needed to test support for an enterprise application)
test_it(suiteName + ' repeatedly open and delete database faster (5x)', function () {
// TBD POSSIBLY BROKEN on iOS/macOS ...
// if (!isAndroid && !isWindows) pending(...);
Expand Down

0 comments on commit 8b981a9

Please sign in to comment.