metarhia / globalstorage

Distributed Data Warehouse 🌍
https://metarhia.com
MIT License
60 stars 5 forks source link

Add tests for provider.execute() #353

Closed mille-nium closed 5 years ago

mille-nium commented 5 years ago

Closes https://github.com/metarhia/globalstorage/issues/326

mille-nium commented 5 years ago

@nechaido if I move metaschema.load and provider.open to test.beforeEach, there will be an async function (as I have to await metaschema.fs.load) with callback, which looks a little bit weird, nevertheless it works. So should I do this?

test.beforeEach(async (test, callback) => {
  let schema;

  try {
    schema = await metaschema.fs.load(schemasDir, options, config);
  } catch (err) {
    test.fail(err);
    test.end();
    return;
  }

  const provider = new StorageProvider({});

  provider.open({ schema }, test.cbFail(() => callback({ provider })));
}
nechaido commented 5 years ago

@mille-nium seems

@nechaido if I move metaschema.load and provider.open to test.beforeEach, there will be an async function (as I have to await metaschema.fs.load) with callback, which looks a little bit weird, nevertheless it works. So should I do this?

Seems fine.

belochub commented 5 years ago

Landed in https://github.com/metarhia/globalstorage/commit/37bf67f944303e146599cad03f757e5a7f40a60c.