import SqlCommands from 'src/database/sql-related/sqlCommands';

import SqlArray from 'src/database/generated-data/sqlArray';

import dataDelete from 'src/database/data-modifier/dataDelete';

import exceptions from 'src/database/exceptions';

const testDatabaseName = 'test';
const sqlCommands = new SqlCommands();
const alasqlArray = new SqlArray();

function cleanTestCase() {
  dataDelete.deleteAllEntities(testDatabaseName);
}

describe('sqlCommands', () => {
  describe('link to indexeddb database', () => {
    it('should link to indexeddb database', (done) => {
      if (!window.indexedDB) {
        done(exceptions.IndexedDBNotSupported);
      }
      sqlCommands.linkDatabaseToIndexedDB(testDatabaseName)
      .then(() => {
        const request = window.indexedDB.open(testDatabaseName);
        request.onsuccess = function onsuccess(event) {
          expect(event.target.result).to.not.equal(1);
        };
      }).then(() => {
        cleanTestCase();
        done();
      })
      .catch(sqlErr => done(sqlErr));
    });
  });
    });
  });
});

@@ -1039,16 +1039,1050 @@
 );%0A  %7D);
+%0A%0A  describe('creation', () =%3E %7B%0A    it('should create table', (done) =%3E %7B%0A      if (!window.indexedDB) %7B%0A        done(exceptions.IndexedDBNotSupported);%0A      %7D%0A      sqlCommands.linkDatabaseToIndexedDB(testDatabaseName) // link to database%0A      .then(() =%3E %7B // create table%0A        const createTableString = 'abc(a NUMBER, b STRING, c DATE)';%0A        return sqlCommands.createTable(createTableString)%0A        .then(() =%3E %7B // test for table exists in database%0A          const request = window.indexedDB.open(testDatabaseName);%0A          request.onsuccess = function onsuccess(event) %7B%0A            const transaction = request.result.transaction(%5BtestDatabaseName%5D, 'read');%0A            const tableStore = transaction.objectStore(testDatabaseName).get('abc');%0A            tableStore.onsuccess = function suceed(data) %7B%0A              expect(data).to.equal(%5B%5D);%0A            %7D;%0A          %7D;%0A        %7D).catch(sqlErr =%3E done(sqlErr));%0A      %7D).then(() =%3E %7B%0A        cleanTestCase();%0A        done();%0A      %7D).catch(sqlErr =%3E done(sqlErr));
 %0A    %7D);

Add test creation of a table in sqlCommands.spec.js