mirror of
https://github.com/Permissionless-Software-Foundation/ipfs-bch-wallet-consumer.git
synced 2026-09-21 16:52:03 -07:00
63 lines
1.4 KiB
JavaScript
63 lines
1.4 KiB
JavaScript
/*
|
|
Unit tests for controllers index.js file.
|
|
*/
|
|
|
|
// Public npm libraries
|
|
// const assert = require('chai').assert
|
|
import sinon from 'sinon'
|
|
|
|
import Controllers from '../../../src/controllers/index.js'
|
|
|
|
describe('#Controllers', () => {
|
|
let uut
|
|
let sandbox
|
|
|
|
beforeEach(() => {
|
|
sandbox = sinon.createSandbox()
|
|
|
|
uut = new Controllers()
|
|
})
|
|
|
|
afterEach(() => sandbox.restore())
|
|
|
|
describe('#attachControllers', () => {
|
|
it('should attach the controllers', async () => {
|
|
// mock IPFS
|
|
sandbox.stub(uut.adapters, 'start').resolves({})
|
|
uut.adapters.ipfs.ipfsCoordAdapter = {
|
|
attachRPCRouter: () => {}
|
|
}
|
|
|
|
// Mock the timer controllers
|
|
sandbox.stub(uut.timerControllers, 'startTimers').returns()
|
|
|
|
const app = {
|
|
use: () => {}
|
|
}
|
|
|
|
await uut.attachControllers(app)
|
|
})
|
|
})
|
|
describe('#attachRESTControllers', () => {
|
|
it('should attach the controllers', async () => {
|
|
const app = {
|
|
use: () => {}
|
|
}
|
|
|
|
await uut.attachRESTControllers(app)
|
|
})
|
|
})
|
|
describe('#initAdapters', () => {
|
|
it('should attach the controllers', async () => {
|
|
sandbox.stub(uut.adapters, 'start').resolves({})
|
|
await uut.initAdapters()
|
|
})
|
|
})
|
|
describe('#initUseCases', () => {
|
|
it('should attach the controllers', async () => {
|
|
sandbox.stub(uut.useCases, 'start').resolves({})
|
|
await uut.initUseCases()
|
|
})
|
|
})
|
|
})
|