Skip to content

Commit

Permalink
Merge pull request #20 from fahamutech/test_refactor_and_structure
Browse files Browse the repository at this point in the history
Test refactor and structure
  • Loading branch information
joshuamshana authored Jan 18, 2022
2 parents b562f62 + 4dfd6b9 commit 040a472
Show file tree
Hide file tree
Showing 122 changed files with 7,949 additions and 17,573 deletions.
2 changes: 1 addition & 1 deletion .mocharc.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ module.exports = {
bail: true,
timeout: 2000,
recursive: true,
require: 'specs/hook.mjs'
require: 'hooks.mjs'
}
11 changes: 0 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1 @@
## Get stated
This repository use mongodb as a database engine so you need to have it localy
even though it spin its own in memory latest mongodb when run test ( test for ubuntu & debian OS & Chrome OS ). In chrome os you need to install mongodb in your machine and update this file [config-mock](./specs/mock.config.js). That file contain more configuration for tests.

NOTE: Your mongo instance must be in Replica mode fot transactions and stream changes tests to work.

## Contribute

1. Clone repository
2. run `yarn install`
3. run `yarn test` to runn all tests
4. Add new features write its test and run `yarn test` or `npx mocha specs/<path-to-your-test-file>`
21 changes: 0 additions & 21 deletions gulpfile.mjs

This file was deleted.

35 changes: 22 additions & 13 deletions specs/hook.mjs → hooks.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
import {start} from "bfast-function";
import mock from './mock.config.js';
import { dirname } from 'path';
import { fileURLToPath } from 'url';

const {config} = mock;
import {dirname} from 'path';
import {fileURLToPath} from 'url';

const config = {
applicationId: 'bfast',
useLocalIpfs: true,
projectId: 'bfast',
port: '3111',
logs: false,
web3Token: process.env['WEB_3_TOKEN'],
adapters: {s3Storage: undefined},
masterKey: 'bfast',
taarifaToken: undefined,
databaseURI: 'mongodb://localhost/bfast',
rsaKeyPairInJson: {},
rsaPublicKeyInJson: {}
}

const __dirname = dirname(fileURLToPath(import.meta.url));

export const mochaHooks = {
Expand All @@ -17,22 +31,17 @@ export const mochaHooks = {
process.env.RSA_PUBLIC_KEY = JSON.stringify(config.rsaPublicKeyInJson);
process.env.RSA_KEY = JSON.stringify(config.rsaKeyPairInJson);
process.env.USE_LOCAL_IPFS = 'true';
// process.env.LOGS = '0';
console.log('________ START__________');
// const r = require('./functions/serve');
// console.log(r);
// ySocketServer = await startYJsWebsocketServer();
console.log('________START__________');
await start({
port: config.port,
functionsConfig: {
functionsDirPath: __dirname + '/functions',
bfastJsonPath: __dirname + '/bfast.json'
functionsDirPath: __dirname + '/specs/functions',
bfastJsonPath: __dirname + '/specs/bfast.json'
}
}).catch(console.log);
},
async afterAll() {
console.log('________END__________');
// process.kill(ySocketServer.pid);
// await bfastFs.stop();
}
};

Loading

0 comments on commit 040a472

Please sign in to comment.