mirror of
https://github.com/Permissionless-Software-Foundation/bch-dex.git
synced 2026-09-21 16:52:00 -07:00
Fixing merge conflicts
This commit is contained in:
+39
-23
@@ -32,32 +32,38 @@ const webhookLib = new WebHookLib()
|
|||||||
|
|
||||||
const errorMiddleware = require('../src/controllers/rest-api/middleware/error')
|
const errorMiddleware = require('../src/controllers/rest-api/middleware/error')
|
||||||
// const { wlogger } = require('../src/adapters/wlogger')
|
// const { wlogger } = require('../src/adapters/wlogger')
|
||||||
|
const Controllers = require('../src/controllers')
|
||||||
|
|
||||||
class Server {
|
class Server {
|
||||||
constructor () {
|
constructor () {
|
||||||
|
// Encapsulate dependencies
|
||||||
this.adminLib = new AdminLib()
|
this.adminLib = new AdminLib()
|
||||||
|
this.controllers = new Controllers()
|
||||||
|
this.mongoose = mongoose
|
||||||
|
this.config = config
|
||||||
|
this.process = process
|
||||||
}
|
}
|
||||||
|
|
||||||
async startServer () {
|
async startServer () {
|
||||||
try {
|
try {
|
||||||
// Create a Koa instance.
|
// Create a Koa instance.
|
||||||
const app = new Koa()
|
const app = new Koa()
|
||||||
app.keys = [config.session]
|
app.keys = [this.config.session]
|
||||||
|
|
||||||
// Connect to the Mongo Database.
|
// Connect to the Mongo Database.
|
||||||
mongoose.Promise = global.Promise
|
this.mongoose.Promise = global.Promise
|
||||||
mongoose.set('useCreateIndex', true) // Stop deprecation warning.
|
this.mongoose.set('useCreateIndex', true) // Stop deprecation warning.
|
||||||
console.log(
|
console.log(
|
||||||
`Connecting to MongoDB with this connection string: ${config.database}`
|
`Connecting to MongoDB with this connection string: ${this.config.database}`
|
||||||
)
|
)
|
||||||
await mongoose.connect(config.database, {
|
await this.mongoose.connect(this.config.database, {
|
||||||
useUnifiedTopology: true,
|
useUnifiedTopology: true,
|
||||||
useNewUrlParser: true
|
useNewUrlParser: true
|
||||||
})
|
})
|
||||||
|
|
||||||
console.log(`Starting environment: ${config.env}`)
|
console.log(`Starting environment: ${this.config.env}`)
|
||||||
console.log(`Debug level: ${config.debugLevel}\n`)
|
console.log(`Debug level: ${this.config.debugLevel}\n`)
|
||||||
console.log(`Using this web3 CashStack service: ${config.consumerUrl}`)
|
console.log(`Using this web3 CashStack service: ${this.config.consumerUrl}`)
|
||||||
console.log('Alternative web services listed here: https://gist.github.com/christroutner/63c5513782181f8b8ea3eb89f7cadeb6')
|
console.log('Alternative web services listed here: https://gist.github.com/christroutner/63c5513782181f8b8ea3eb89f7cadeb6')
|
||||||
console.log('This app is built on top of the CashStack. Find out more: https://CashStack.info\n')
|
console.log('This app is built on top of the CashStack. Find out more: https://CashStack.info\n')
|
||||||
|
|
||||||
@@ -84,17 +90,21 @@ class Server {
|
|||||||
// Dev Note: This line must come BEFORE controllers.attachRESTControllers()
|
// Dev Note: This line must come BEFORE controllers.attachRESTControllers()
|
||||||
app.use(cors({ origin: '*' }))
|
app.use(cors({ origin: '*' }))
|
||||||
|
|
||||||
// Attach REST API and JSON RPC controllers to the app.
|
// Wait for any adapters to initialize.
|
||||||
const Controllers = require('../src/controllers')
|
await this.controllers.initAdapters()
|
||||||
const controllers = new Controllers()
|
|
||||||
await controllers.attachRESTControllers(app)
|
|
||||||
|
|
||||||
app.controllers = controllers
|
// Wait for any use-libraries to initialize.
|
||||||
|
await this.controllers.initUseCases()
|
||||||
|
|
||||||
|
// Attach REST API and JSON RPC controllers to the app.
|
||||||
|
await this.controllers.attachRESTControllers(app)
|
||||||
|
|
||||||
|
app.controllers = this.controllers
|
||||||
|
|
||||||
// MIDDLEWARE END
|
// MIDDLEWARE END
|
||||||
|
|
||||||
// Delay startup to give the P2WDB time to start first, so that it accepts the webook call
|
// Delay startup to give the P2WDB time to start first, so that it accepts the webook call
|
||||||
await sleep(20000)
|
await this.sleep(20000)
|
||||||
|
|
||||||
// Create webhook
|
// Create webhook
|
||||||
try {
|
try {
|
||||||
@@ -113,7 +123,7 @@ class Server {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// startServer()
|
// startServer()
|
||||||
await app.listen(config.port)
|
this.server = await app.listen(config.port)
|
||||||
console.log(`Server started on ${config.port}`)
|
console.log(`Server started on ${config.port}`)
|
||||||
|
|
||||||
// Create the system admin user.
|
// Create the system admin user.
|
||||||
@@ -122,10 +132,16 @@ class Server {
|
|||||||
|
|
||||||
// Attach the other IPFS controllers.
|
// Attach the other IPFS controllers.
|
||||||
// Skip if this is a test environment.
|
// Skip if this is a test environment.
|
||||||
if (config.env !== 'test') {
|
if (this.config.env !== 'test') {
|
||||||
await controllers.attachControllers(app)
|
await this.controllers.attachControllers(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Display configuration settings
|
||||||
|
console.log('\nConfiguration:')
|
||||||
|
console.log(`Circuit Relay: ${this.config.isCircuitRelay}`)
|
||||||
|
console.log(`IPFS TCP port: ${this.config.ipfsTcpPort}`)
|
||||||
|
console.log(`IPFS WS port: ${this.config.ipfsWsPort}\n`)
|
||||||
|
|
||||||
return app
|
return app
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Could not start server. Error: ', err)
|
console.error('Could not start server. Error: ', err)
|
||||||
@@ -133,14 +149,14 @@ class Server {
|
|||||||
console.log(
|
console.log(
|
||||||
'Exiting after 5 seconds. Depending on process manager to restart.'
|
'Exiting after 5 seconds. Depending on process manager to restart.'
|
||||||
)
|
)
|
||||||
await sleep(5000)
|
await this.sleep(5000)
|
||||||
process.exit(1)
|
this.process.exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sleep (ms) {
|
||||||
|
return new Promise((resolve) => setTimeout(resolve, ms))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function sleep (ms) {
|
|
||||||
return new Promise((resolve) => setTimeout(resolve, ms))
|
|
||||||
}
|
|
||||||
|
|
||||||
module.exports = Server
|
module.exports = Server
|
||||||
|
|||||||
Vendored
+3
-1
@@ -104,5 +104,7 @@ module.exports = {
|
|||||||
ipfsHost: process.env.IPFS_HOST ? process.env.IPFS_HOST : 'localhost',
|
ipfsHost: process.env.IPFS_HOST ? process.env.IPFS_HOST : 'localhost',
|
||||||
ipfsApiPort: process.env.IPFS_API_PORT
|
ipfsApiPort: process.env.IPFS_API_PORT
|
||||||
? parseInt(process.env.IPFS_API_PORT)
|
? parseInt(process.env.IPFS_API_PORT)
|
||||||
: 5001
|
: 5001,
|
||||||
|
|
||||||
|
chatPubSubChan: 'psf-ipfs-chat-001'
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
const common = require('./env/common')
|
const common = require('./env/common')
|
||||||
|
|
||||||
const env = process.env.BCH_ENV || 'development'
|
const env = process.env.BCH_DEX || 'development'
|
||||||
const config = require(`./env/${env}`)
|
const config = require(`./env/${env}`)
|
||||||
|
|
||||||
module.exports = Object.assign({}, common, config)
|
module.exports = Object.assign({}, common, config)
|
||||||
|
|||||||
Generated
+13071
-14400
File diff suppressed because it is too large
Load Diff
+9
-9
@@ -27,14 +27,14 @@
|
|||||||
},
|
},
|
||||||
"repository": "Permissionless-Software-Foundation/bch-dex",
|
"repository": "Permissionless-Software-Foundation/bch-dex",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@psf/bch-js": "6.3.1",
|
"@psf/bch-js": "6.4.1",
|
||||||
"axios": "0.21.1",
|
"axios": "0.27.2",
|
||||||
"bch-message-lib": "2.2.0",
|
"bch-message-lib": "2.2.0",
|
||||||
"bcryptjs": "2.4.3",
|
"bcryptjs": "2.4.3",
|
||||||
"bitcoincashjs-lib": "3.3.3",
|
"bitcoincashjs-lib": "3.3.3",
|
||||||
"glob": "7.1.6",
|
"glob": "7.1.6",
|
||||||
"ipfs": "0.60.0",
|
"ipfs": "0.62.3",
|
||||||
"ipfs-coord": "7.1.6",
|
"ipfs-coord": "7.1.19",
|
||||||
"ipfs-http-client": "55.0.0",
|
"ipfs-http-client": "55.0.0",
|
||||||
"jsonrpc-lite": "2.2.0",
|
"jsonrpc-lite": "2.2.0",
|
||||||
"jsonwebtoken": "8.5.1",
|
"jsonwebtoken": "8.5.1",
|
||||||
@@ -55,7 +55,7 @@
|
|||||||
"minimal-slp-wallet": "4.6.3",
|
"minimal-slp-wallet": "4.6.3",
|
||||||
"mongoose": "5.13.13",
|
"mongoose": "5.13.13",
|
||||||
"node-fetch": "npm:@achingbrain/node-fetch@2.6.7",
|
"node-fetch": "npm:@achingbrain/node-fetch@2.6.7",
|
||||||
"nodemailer": "6.4.17",
|
"nodemailer": "6.7.5",
|
||||||
"p2wdb": "1.4.0",
|
"p2wdb": "1.4.0",
|
||||||
"passport-local": "1.0.0",
|
"passport-local": "1.0.0",
|
||||||
"public-ip": "^4.0.4",
|
"public-ip": "^4.0.4",
|
||||||
@@ -63,8 +63,8 @@
|
|||||||
"winston-daily-rotate-file": "4.5.0"
|
"winston-daily-rotate-file": "4.5.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"apidoc": "0.26.0",
|
"apidoc": "0.51.1",
|
||||||
"bch-token-sweep": "2.1.1",
|
"bch-token-sweep": "2.1.2",
|
||||||
"chai": "4.3.0",
|
"chai": "4.3.0",
|
||||||
"coveralls": "2.11.4",
|
"coveralls": "2.11.4",
|
||||||
"eslint": "7.19.0",
|
"eslint": "7.19.0",
|
||||||
@@ -75,9 +75,9 @@
|
|||||||
"eslint-plugin-promise": "^4.3.1",
|
"eslint-plugin-promise": "^4.3.1",
|
||||||
"eslint-plugin-standard": "4.0.0",
|
"eslint-plugin-standard": "4.0.0",
|
||||||
"husky": "4.3.8",
|
"husky": "4.3.8",
|
||||||
"mocha": "8.4.0",
|
"mocha": "10.0.0",
|
||||||
"nyc": "15.1.0",
|
"nyc": "15.1.0",
|
||||||
"semantic-release": "17.4.4",
|
"semantic-release": "19.0.3",
|
||||||
"sinon": "9.2.4",
|
"sinon": "9.2.4",
|
||||||
"standard": "16.0.4",
|
"standard": "16.0.4",
|
||||||
"uuid": "8.3.2"
|
"uuid": "8.3.2"
|
||||||
|
|||||||
+8
-21
@@ -20,26 +20,6 @@ const BCHAdapter = require('./bch')
|
|||||||
const WalletAdapter = require('./wallet')
|
const WalletAdapter = require('./wallet')
|
||||||
const P2wdbAdapter = require('./p2wdb-adapter')
|
const P2wdbAdapter = require('./p2wdb-adapter')
|
||||||
|
|
||||||
//
|
|
||||||
// // Instantiate adapter libraries.
|
|
||||||
// const ipfs = new IPFSAdapter()
|
|
||||||
// const localdb = new LocalDB()
|
|
||||||
// const logapi = new LogsAPI()
|
|
||||||
// const passport = new Passport()
|
|
||||||
// const nodemailer = new Nodemailer()
|
|
||||||
// const jsonFiles = new JSONFiles()
|
|
||||||
// const bchjs = new BCHJSAdapter()
|
|
||||||
//
|
|
||||||
// module.exports = {
|
|
||||||
// ipfs,
|
|
||||||
// localdb,
|
|
||||||
// logapi,
|
|
||||||
// passport,
|
|
||||||
// nodemailer,
|
|
||||||
// wlogger,
|
|
||||||
// jsonFiles,
|
|
||||||
// bchjs
|
|
||||||
|
|
||||||
const config = require('../../config')
|
const config = require('../../config')
|
||||||
|
|
||||||
class Adapters {
|
class Adapters {
|
||||||
@@ -73,7 +53,10 @@ class Adapters {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Start the IPFS node.
|
// Start the IPFS node.
|
||||||
// await this.ipfs.start()
|
// Do not start these adapters if this is an e2e test.
|
||||||
|
if (this.config.env !== 'test') {
|
||||||
|
await this.ipfs.start()
|
||||||
|
}
|
||||||
|
|
||||||
// Open the wallet file
|
// Open the wallet file
|
||||||
const walletData = await this.wallet.openWallet()
|
const walletData = await this.wallet.openWallet()
|
||||||
@@ -81,6 +64,10 @@ class Adapters {
|
|||||||
|
|
||||||
// Instance the wallet.
|
// Instance the wallet.
|
||||||
await this.wallet.instanceWallet(walletData, this.bchjs)
|
await this.wallet.instanceWallet(walletData, this.bchjs)
|
||||||
|
|
||||||
|
console.log('Async Adapters have been started.')
|
||||||
|
|
||||||
|
return true
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error in adapters/index.js/start()')
|
console.error('Error in adapters/index.js/start()')
|
||||||
throw err
|
throw err
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
top-level IPFS library that combines the individual IPFS-based libraries.
|
top-level IPFS library that combines the individual IPFS-based libraries.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
// Local libraries
|
||||||
const IpfsAdapter = require('./ipfs')
|
const IpfsAdapter = require('./ipfs')
|
||||||
const IpfsCoordAdapter = require('./ipfs-coord')
|
const IpfsCoordAdapter = require('./ipfs-coord')
|
||||||
|
|
||||||
@@ -36,6 +37,9 @@ class IPFS {
|
|||||||
await this.ipfsCoordAdapter.start()
|
await this.ipfsCoordAdapter.start()
|
||||||
console.log('ipfs-coord is ready.')
|
console.log('ipfs-coord is ready.')
|
||||||
|
|
||||||
|
// Subscribe to the chat pubsub channel
|
||||||
|
await this.ipfsCoordAdapter.subscribeToChat()
|
||||||
|
|
||||||
return true
|
return true
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error in adapters/ipfs/index.js/start()')
|
console.error('Error in adapters/ipfs/index.js/start()')
|
||||||
|
|||||||
@@ -97,6 +97,15 @@ class IpfsCoordAdapter {
|
|||||||
throw err
|
throw err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Subscribe to the chat pubsub channel
|
||||||
|
async subscribeToChat () {
|
||||||
|
await this.ipfsCoord.adapters.pubsub.subscribeToPubsubChannel(
|
||||||
|
this.config.chatPubSubChan,
|
||||||
|
console.log,
|
||||||
|
this.ipfsCoord.thisNode
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = IpfsCoordAdapter
|
module.exports = IpfsCoordAdapter
|
||||||
|
|||||||
@@ -135,8 +135,10 @@ class LogsApi {
|
|||||||
if (!filename || typeof filename !== 'string') {
|
if (!filename || typeof filename !== 'string') {
|
||||||
throw new Error('filename must be a string')
|
throw new Error('filename must be a string')
|
||||||
}
|
}
|
||||||
// Throw an error if the file does not exist.
|
|
||||||
|
|
||||||
|
console.log('readLines() filename: ', filename)
|
||||||
|
|
||||||
|
// Throw an error if the file does not exist.
|
||||||
if (!_this.fs.existsSync(filename)) {
|
if (!_this.fs.existsSync(filename)) {
|
||||||
throw new Error('file does not exist')
|
throw new Error('file does not exist')
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,17 +17,18 @@ class Controllers {
|
|||||||
constructor (localConfig = {}) {
|
constructor (localConfig = {}) {
|
||||||
this.adapters = new Adapters()
|
this.adapters = new Adapters()
|
||||||
this.useCases = new UseCases({ adapters: this.adapters })
|
this.useCases = new UseCases({ adapters: this.adapters })
|
||||||
|
|
||||||
|
this.timerControllers = new TimerControllers({ adapters: this.adapters, useCases: this.useCases })
|
||||||
}
|
}
|
||||||
|
|
||||||
async attachControllers (app) {
|
// Spin up any adapter libraries that have async startup needs.
|
||||||
// Wait for any startup processes to complete for the Adapters libraries.
|
async initAdapters () {
|
||||||
await this.adapters.start()
|
await this.adapters.start()
|
||||||
|
}
|
||||||
|
|
||||||
// Attach the REST controllers to the Koa app.
|
// Run any Use Cases to startup the app.
|
||||||
// this.attachRESTControllers(app)
|
async initUseCases () {
|
||||||
|
await this.useCases.start()
|
||||||
// this.attachRPCControllers()
|
|
||||||
this.timerControllers = new TimerControllers({ adapters: this.adapters, useCases: this.useCases })
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Top-level function for this library.
|
// Top-level function for this library.
|
||||||
@@ -42,6 +43,17 @@ class Controllers {
|
|||||||
restControllers.attachRESTControllers(app)
|
restControllers.attachRESTControllers(app)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Attach any other controllers other than REST API controllers.
|
||||||
|
async attachControllers (app) {
|
||||||
|
// Wait for any startup processes to complete for the Adapters libraries.
|
||||||
|
// await this.adapters.start()
|
||||||
|
|
||||||
|
// Attach the REST controllers to the Koa app.
|
||||||
|
// this.attachRESTControllers(app)
|
||||||
|
|
||||||
|
this.attachRPCControllers()
|
||||||
|
}
|
||||||
|
|
||||||
// Add the JSON RPC router to the ipfs-coord adapter.
|
// Add the JSON RPC router to the ipfs-coord adapter.
|
||||||
attachRPCControllers () {
|
attachRPCControllers () {
|
||||||
const jsonRpcController = new JSONRPC({
|
const jsonRpcController = new JSONRPC({
|
||||||
|
|||||||
@@ -25,6 +25,19 @@ class UseCases {
|
|||||||
localConfig.order = this.order
|
localConfig.order = this.order
|
||||||
this.offer = new OfferUseCases(localConfig)
|
this.offer = new OfferUseCases(localConfig)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Run any startup Use Cases at the start of the app.
|
||||||
|
async start () {
|
||||||
|
// try {
|
||||||
|
console.log('Async Use Cases have been started.')
|
||||||
|
|
||||||
|
return true
|
||||||
|
// } catch (err) {
|
||||||
|
// console.error('Error in use-cases/index.js/start()')
|
||||||
|
// // console.log(err)
|
||||||
|
// throw err
|
||||||
|
// }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = UseCases
|
module.exports = UseCases
|
||||||
|
|||||||
@@ -7,6 +7,7 @@
|
|||||||
// Public npm libraries
|
// Public npm libraries
|
||||||
const assert = require('chai').assert
|
const assert = require('chai').assert
|
||||||
const axios = require('axios').default
|
const axios = require('axios').default
|
||||||
|
// const sinon = require('sinon')
|
||||||
|
|
||||||
// Local support libraries
|
// Local support libraries
|
||||||
const config = require('../../../config')
|
const config = require('../../../config')
|
||||||
|
|||||||
@@ -0,0 +1,54 @@
|
|||||||
|
/*
|
||||||
|
Unit tests for the adapters index.js library
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Global npm libraries
|
||||||
|
const assert = require('chai').assert
|
||||||
|
const sinon = require('sinon')
|
||||||
|
|
||||||
|
// Local libraries
|
||||||
|
const Adapters = require('../../../src/adapters')
|
||||||
|
|
||||||
|
describe('#adapters', () => {
|
||||||
|
let uut, sandbox
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
uut = new Adapters()
|
||||||
|
|
||||||
|
sandbox = sinon.createSandbox()
|
||||||
|
})
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
sandbox.restore()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('#start', () => {
|
||||||
|
it('should start the async adapters', async () => {
|
||||||
|
// Mock dependencies
|
||||||
|
uut.config.getJwtAtStartup = true
|
||||||
|
sandbox.stub(uut.fullStackJwt, 'getJWT').resolves()
|
||||||
|
sandbox.stub(uut.fullStackJwt, 'instanceBchjs').resolves()
|
||||||
|
sandbox.stub(uut.ipfs, 'start').resolves()
|
||||||
|
|
||||||
|
const result = await uut.start()
|
||||||
|
|
||||||
|
assert.equal(result, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should catch and throw an error', async () => {
|
||||||
|
try {
|
||||||
|
// Force an error
|
||||||
|
uut.config.getJwtAtStartup = false
|
||||||
|
uut.config.env = 'dev'
|
||||||
|
sandbox.stub(uut.ipfs, 'start').rejects(new Error('test error'))
|
||||||
|
|
||||||
|
await uut.start()
|
||||||
|
|
||||||
|
assert.fail('Unexpected result')
|
||||||
|
} catch (err) {
|
||||||
|
// console.log('err: ', err)
|
||||||
|
assert.include(err.message, 'test error')
|
||||||
|
}
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -8,6 +8,7 @@ const sinon = require('sinon')
|
|||||||
const IPFSCoordAdapter = require('../../../src/adapters/ipfs/ipfs-coord')
|
const IPFSCoordAdapter = require('../../../src/adapters/ipfs/ipfs-coord')
|
||||||
const IPFSMock = require('../mocks/ipfs-mock')
|
const IPFSMock = require('../mocks/ipfs-mock')
|
||||||
const IPFSCoordMock = require('../mocks/ipfs-coord-mock')
|
const IPFSCoordMock = require('../mocks/ipfs-coord-mock')
|
||||||
|
const config = require('../../../config')
|
||||||
|
|
||||||
describe('#IPFS', () => {
|
describe('#IPFS', () => {
|
||||||
let uut
|
let uut
|
||||||
@@ -61,6 +62,16 @@ describe('#IPFS', () => {
|
|||||||
|
|
||||||
assert.equal(result, true)
|
assert.equal(result, true)
|
||||||
})
|
})
|
||||||
|
it('should return a promise that resolves into an instance of IPFS in production mode', async () => {
|
||||||
|
uut.config.isProduction = true
|
||||||
|
// Mock dependencies.
|
||||||
|
uut.IpfsCoord = IPFSCoordMock
|
||||||
|
|
||||||
|
const result = await uut.start()
|
||||||
|
// console.log('result: ', result)
|
||||||
|
assert.equal(result, true)
|
||||||
|
config.isProduction = false
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe('#attachRPCRouter', () => {
|
describe('#attachRPCRouter', () => {
|
||||||
@@ -101,4 +112,20 @@ describe('#IPFS', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('#subscribeToChat', () => {
|
||||||
|
it('should subscribe to the chat channel', async () => {
|
||||||
|
// Mock dependencies
|
||||||
|
uut.ipfsCoord = {
|
||||||
|
adapters: {
|
||||||
|
pubsub: {
|
||||||
|
subscribeToPubsubChannel: async () => {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
await uut.subscribeToChat()
|
||||||
|
})
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -32,19 +32,18 @@ describe('#LogsApiLib', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should return log', async () => {
|
it('should return log', async () => {
|
||||||
try {
|
// Mock dependencies
|
||||||
const pass = 'test'
|
sandbox.stub(uut, 'generateFileName').returns(`${__dirname.toString()}/../mocks/adapters/fake-log`)
|
||||||
const result = await uut.getLogs(pass)
|
|
||||||
// console.log('result', result)
|
|
||||||
|
|
||||||
assert.isTrue(result.success)
|
const pass = 'test'
|
||||||
assert.isArray(result.data)
|
const result = await uut.getLogs(pass)
|
||||||
assert.property(result.data[0], 'message')
|
// console.log('result', result)
|
||||||
assert.property(result.data[0], 'level')
|
|
||||||
assert.property(result.data[0], 'timestamp')
|
assert.isTrue(result.success)
|
||||||
} catch (err) {
|
assert.isArray(result.data)
|
||||||
assert(false, 'Unexpected result')
|
assert.property(result.data[0], 'message')
|
||||||
}
|
assert.property(result.data[0], 'level')
|
||||||
|
assert.property(result.data[0], 'timestamp')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return false if files are not found!', async () => {
|
it('should return false if files are not found!', async () => {
|
||||||
@@ -201,31 +200,25 @@ describe('#LogsApiLib', () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
it('should ignore fileReader callback errors', async () => {
|
it('should ignore fileReader callback errors', async () => {
|
||||||
try {
|
// https://sinonjs.org/releases/latest/stubs/
|
||||||
// https://sinonjs.org/releases/latest/stubs/
|
// About yields
|
||||||
// About yields
|
sandbox.stub(uut.lineReader, 'eachLine').yieldsRight({}, true)
|
||||||
sandbox.stub(uut.lineReader, 'eachLine').yieldsRight({}, true)
|
|
||||||
|
|
||||||
const fileName = context.fileName
|
const fileName = `${__dirname.toString()}/../mocks/adapters/fake-log`
|
||||||
const result = await uut.readLines(fileName)
|
|
||||||
assert.isArray(result)
|
const result = await uut.readLines(fileName)
|
||||||
} catch (err) {
|
assert.isArray(result)
|
||||||
assert.fail('Unexpected result')
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should return data', async () => {
|
it('should return data', async () => {
|
||||||
try {
|
const fileName = `${__dirname.toString()}/../mocks/adapters/fake-log`
|
||||||
const fileName = context.fileName
|
|
||||||
const result = await uut.readLines(fileName)
|
|
||||||
|
|
||||||
assert.isArray(result)
|
const result = await uut.readLines(fileName)
|
||||||
assert.property(result[1], 'message')
|
|
||||||
assert.property(result[1], 'level')
|
assert.isArray(result)
|
||||||
assert.property(result[1], 'timestamp')
|
assert.property(result[1], 'message')
|
||||||
} catch (err) {
|
assert.property(result[1], 'level')
|
||||||
assert.fail('Unexpected result')
|
assert.property(result[1], 'timestamp')
|
||||||
}
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -0,0 +1,66 @@
|
|||||||
|
/*
|
||||||
|
Unit tests for the bin/server.js file
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Public npm libraries
|
||||||
|
const assert = require('chai').assert
|
||||||
|
const sinon = require('sinon')
|
||||||
|
|
||||||
|
// Local libraries
|
||||||
|
const Server = require('../../../bin/server')
|
||||||
|
|
||||||
|
describe('#server', () => {
|
||||||
|
let uut, sandbox
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
sandbox = sinon.createSandbox()
|
||||||
|
|
||||||
|
uut = new Server()
|
||||||
|
})
|
||||||
|
|
||||||
|
afterEach(() => sandbox.restore())
|
||||||
|
|
||||||
|
describe('#startServer', () => {
|
||||||
|
it('should start the server', async () => {
|
||||||
|
// Mock dependencies
|
||||||
|
sandbox.stub(uut.mongoose, 'connect').resolves()
|
||||||
|
sandbox.stub(uut.controllers, 'initAdapters').resolves()
|
||||||
|
sandbox.stub(uut.controllers, 'initUseCases').resolves()
|
||||||
|
sandbox.stub(uut.controllers, 'attachRESTControllers').resolves()
|
||||||
|
sandbox.stub(uut.adminLib, 'createSystemUser').resolves(true)
|
||||||
|
sandbox.stub(uut.controllers, 'attachControllers').resolves()
|
||||||
|
sandbox.stub(uut, 'sleep').resolves()
|
||||||
|
uut.config.env = 'dev'
|
||||||
|
|
||||||
|
const result = await uut.startServer()
|
||||||
|
// console.log('result: ', result)
|
||||||
|
|
||||||
|
assert.property(result, 'env')
|
||||||
|
|
||||||
|
// Turn off the server.
|
||||||
|
uut.server.close()
|
||||||
|
|
||||||
|
// Restor config env
|
||||||
|
uut.config.env = 'test'
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should exit on failure', async () => {
|
||||||
|
// Force an error
|
||||||
|
sandbox.stub(uut.mongoose, 'connect').rejects(new Error('test error'))
|
||||||
|
|
||||||
|
// Prevent default behavior of exiting the program.
|
||||||
|
sandbox.stub(uut, 'sleep').resolves()
|
||||||
|
sandbox.stub(uut.process, 'exit').returns()
|
||||||
|
|
||||||
|
await uut.startServer()
|
||||||
|
|
||||||
|
// Not throwing an error is a success
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('#sleep', () => {
|
||||||
|
it('should execute', async () => {
|
||||||
|
await uut.sleep(1)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:36:43.907Z"}
|
||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:36:43.909Z"}
|
||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:36:43.910Z"}
|
||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:36:43.912Z"}
|
||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:36:43.915Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/sendEmail()","timestamp":"2022-06-27T17:36:58.979Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/sendEmail()","timestamp":"2022-06-27T17:36:58.980Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/sendEmail()","timestamp":"2022-06-27T17:36:58.981Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/sendEmail()","timestamp":"2022-06-27T17:36:58.982Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/sendEmail()","timestamp":"2022-06-27T17:36:58.983Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/validateEmailArray()","timestamp":"2022-06-27T17:36:59.002Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/validateEmailArray()","timestamp":"2022-06-27T17:36:59.003Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/getHtmlFromObject()","timestamp":"2022-06-27T17:36:59.005Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/getHtmlFromObject()","timestamp":"2022-06-27T17:36:59.006Z"}
|
||||||
|
{"level":"error","message":"Error in lib/nodemailer.js/getHtmlFromObject()","timestamp":"2022-06-27T17:36:59.008Z"}
|
||||||
|
{"level":"info","message":"Warning: Can not send JSON RPC response. Can not determine which peer this message came from.","timestamp":"2022-06-27T17:36:59.353Z"}
|
||||||
|
{"level":"info","message":"Rejecting invalid JSON RPC command.","timestamp":"2022-06-27T17:36:59.354Z"}
|
||||||
|
{"level":"info","message":"JSON RPC received from peerA, ID: ea442e78-2297-466a-823b-9cbb12c8ddd9, type: request, method: unknownMethod","timestamp":"2022-06-27T17:36:59.355Z"}
|
||||||
|
{"level":"error","message":"Error in rpc router(): test error","stack":"Error: test error\n at Context.<anonymous> (/home/trout/work/psf/code/ipfs-service-provider/test/unit/controllers/json-rpc/a10-rpc.unit.js:110:49)\n at callFn (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runnable.js:366:21)\n at Test.Runnable.run (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runnable.js:354:5)\n at Runner.runTest (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:666:10)\n at /home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:789:12\n at next (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:581:14)\n at /home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:591:7\n at next (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:474:14)\n at Immediate._onImmediate (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:559:5)\n at processImmediate (node:internal/timers:466:21)","timestamp":"2022-06-27T17:36:59.357Z"}
|
||||||
|
{"level":"info","message":"JSON RPC received from peerA, ID: 9ef6ad90-7fc3-4cb3-8769-4498e5512b3d, type: request, method: users","timestamp":"2022-06-27T17:36:59.358Z"}
|
||||||
|
{"level":"info","message":"JSON RPC received from peerA, ID: bd57a1cf-7f2f-4ff2-93d4-6727eec4d778, type: request, method: auth","timestamp":"2022-06-27T17:36:59.359Z"}
|
||||||
|
{"level":"info","message":"JSON RPC received from peerA, ID: 8fd9edc8-6a45-4042-ac06-9ace60567cbf, type: request, method: about","timestamp":"2022-06-27T17:36:59.361Z"}
|
||||||
|
{"level":"info","message":"JSON RPC received from peerA, ID: 1b27624a-e698-4bbe-9183-b860a1a0d78d, type: request, method: unknownMethod","timestamp":"2022-06-27T17:36:59.363Z"}
|
||||||
|
{"level":"info","message":"JSON RPC received from peerA, ID: 40fabddf-59c6-4910-a22c-63da7387f99a, type: request, method: unknownMethod","timestamp":"2022-06-27T17:36:59.365Z"}
|
||||||
|
{"level":"error","message":"Error in authUser(): Login credential do not match","stack":"Error: Login credential do not match\n at Context.<anonymous> (/home/trout/work/psf/code/ipfs-service-provider/test/unit/controllers/json-rpc/auth.json-rpc.controller.unit.js:144:18)\n at callFn (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runnable.js:366:21)\n at Test.Runnable.run (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runnable.js:354:5)\n at Runner.runTest (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:666:10)\n at /home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:789:12\n at next (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:581:14)\n at /home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:591:7\n at next (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:474:14)\n at Immediate.<anonymous> (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:559:5)\n at processImmediate (node:internal/timers:466:21)","timestamp":"2022-06-27T17:37:04.421Z"}
|
||||||
|
{"level":"error","message":"Error in authUser(): login must be specified","stack":"Error: login must be specified\n at AuthRPC.authUser (/home/trout/work/psf/code/ipfs-service-provider/src/controllers/json-rpc/auth/index.js:78:93)\n at Context.<anonymous> (/home/trout/work/psf/code/ipfs-service-provider/test/unit/controllers/json-rpc/auth.json-rpc.controller.unit.js:165:34)\n at callFn (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runnable.js:366:21)\n at Test.Runnable.run (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runnable.js:354:5)\n at Runner.runTest (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:666:10)\n at /home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:789:12\n at next (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:581:14)\n at /home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:591:7\n at next (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:474:14)\n at Immediate._onImmediate (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:559:5)\n at processImmediate (node:internal/timers:466:21)","timestamp":"2022-06-27T17:37:04.423Z"}
|
||||||
|
{"level":"error","message":"Error in authUser(): password must be specified","stack":"Error: password must be specified\n at AuthRPC.authUser (/home/trout/work/psf/code/ipfs-service-provider/src/controllers/json-rpc/auth/index.js:78:284)\n at Context.<anonymous> (/home/trout/work/psf/code/ipfs-service-provider/test/unit/controllers/json-rpc/auth.json-rpc.controller.unit.js:185:34)\n at callFn (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runnable.js:366:21)\n at Test.Runnable.run (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runnable.js:354:5)\n at Runner.runTest (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:666:10)\n at /home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:789:12\n at next (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:581:14)\n at /home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:591:7\n at next (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:474:14)\n at Immediate._onImmediate (/home/trout/work/psf/code/ipfs-service-provider/node_modules/mocha/lib/runner.js:559:5)\n at processImmediate (node:internal/timers:466:21)","timestamp":"2022-06-27T17:37:04.425Z"}
|
||||||
|
{"level":"error","timestamp":"2022-06-27T17:37:04.466Z"}
|
||||||
|
{"level":"info","message":"Running server in environment: dev","timestamp":"2022-06-27T17:37:04.487Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:04.495Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:04.495Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:04.496Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:04.497Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:04.497Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/getAllUsers()","timestamp":"2022-06-27T17:37:04.499Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:04.502Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:04.503Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:04.503Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:04.504Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:04.505Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:04.506Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/deleteUser()","timestamp":"2022-06-27T17:37:04.508Z"}
|
||||||
|
{"level":"info","message":"Running server in environment: test","timestamp":"2022-06-27T17:37:04.514Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:04.638Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:05.273Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:05.277Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:05.280Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:05.286Z"}
|
||||||
|
{"level":"error","timestamp":"2022-06-27T17:37:05.412Z"}
|
||||||
|
{"level":"verbose","message":"Calling user and target user do not match! Calling user: 62b9eac1b4f08950b955d27f, Target user: 1","timestamp":"2022-06-27T17:37:05.441Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:05.448Z"}
|
||||||
|
{"level":"verbose","message":"Calling user and target user do not match! Calling user: 62b9eac1b4f08950b955d27f, Target user: 62b9eac1b4f08950b955d27d","timestamp":"2022-06-27T17:37:05.452Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:05.457Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:05.463Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:05.467Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/updateUser()","timestamp":"2022-06-27T17:37:05.473Z"}
|
||||||
|
{"level":"verbose","message":"Calling user and target user do not match! Calling user: 62b9eac0b4f08950b955d274, Target user: 62b9eac1b4f08950b955d27d","timestamp":"2022-06-27T17:37:05.478Z"}
|
||||||
|
{"level":"verbose","message":"It's ok. The user is an admin.","timestamp":"2022-06-27T17:37:05.478Z"}
|
||||||
|
{"level":"verbose","message":"Calling user and target user do not match! Calling user: 62b9eac1b4f08950b955d27f, Target user: 1","timestamp":"2022-06-27T17:37:05.600Z"}
|
||||||
|
{"level":"verbose","message":"Calling user and target user do not match! Calling user: 62b9eac1b4f08950b955d27f, Target user: 62b9eac1b4f08950b955d27d","timestamp":"2022-06-27T17:37:05.603Z"}
|
||||||
|
{"level":"verbose","message":"Calling user and target user do not match! Calling user: 62b9eac0b4f08950b955d274, Target user: 62b9eac1b4f08950b955d27d","timestamp":"2022-06-27T17:37:05.615Z"}
|
||||||
|
{"level":"verbose","message":"It's ok. The user is an admin.","timestamp":"2022-06-27T17:37:05.615Z"}
|
||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:37:05.619Z"}
|
||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:37:05.622Z"}
|
||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:37:05.624Z"}
|
||||||
|
{"level":"error","message":"Error in lib/contact.js/sendEmail()","timestamp":"2022-06-27T17:37:05.627Z"}
|
||||||
|
{"level":"verbose","message":"Calling user and target user do not match! Calling user: 62b9eac1b4f08950b955d2a6, Target user: Target Id","timestamp":"2022-06-27T17:37:05.754Z"}
|
||||||
|
{"level":"verbose","message":"Calling user and target user do not match! Calling user: 62b9eac0b4f08950b955d274, Target user: 62b9eac1b4f08950b955d2a6","timestamp":"2022-06-27T17:37:05.756Z"}
|
||||||
|
{"level":"verbose","message":"It's ok. The user is an admin.","timestamp":"2022-06-27T17:37:05.756Z"}
|
||||||
|
{"level":"error","message":"Error in lib/users.js/createUser()","timestamp":"2022-06-27T17:37:06.060Z"}
|
||||||
@@ -8,6 +8,8 @@ class IPFSCoord {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async start () {}
|
async start () {}
|
||||||
|
|
||||||
|
async subscribeToChat() {}
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = IPFSCoord
|
module.exports = IPFSCoord
|
||||||
|
|||||||
@@ -47,4 +47,17 @@ describe('#use-cases', () => {
|
|||||||
}
|
}
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('#start', () => {
|
||||||
|
it('should initialize async use cases', async () => {
|
||||||
|
const result = await uut.start()
|
||||||
|
|
||||||
|
assert.equal(result, true)
|
||||||
|
})
|
||||||
|
|
||||||
|
// it('should catch and throw errors', async () => {
|
||||||
|
// // Force an error
|
||||||
|
// sandbox.stub()
|
||||||
|
// })
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user