Files
ipfs-bch-wallet-service/test/unit/mocks/adapters/index.js
T

107 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-07-13 12:34:51 -07:00
/*
Mocks for the Adapter library.
*/
class IpfsAdapter {
constructor () {
this.ipfs = {
files: {
stat: () => {}
}
}
}
}
class IpfsCoordAdapter {
constructor () {
this.ipfsCoord = {
adapters: {
ipfs: {
connectToPeer: async () => {}
}
},
useCases: {
peer: {
sendPrivateMessage: () => {}
}
},
thisNode: {}
}
2021-07-13 12:34:51 -07:00
}
}
const ipfs = {
ipfsAdapter: new IpfsAdapter(),
2023-10-28 09:17:48 -07:00
ipfsCoordAdapter: new IpfsCoordAdapter(),
getStatus: async () => {},
getPeers: async () => {},
getRelays: async () => {}
}
ipfs.ipfs = ipfs.ipfsAdapter.ipfs
2021-07-13 12:34:51 -07:00
const localdb = {
Users: class Users {
static findById () {}
static find () {}
static findOne () {
return {
validatePassword: localdb.validatePassword
}
}
async save () {
return {}
}
generateToken () {
return '123'
}
toJSON () {
return {}
}
async remove () {
return true
}
async validatePassword () {
return true
}
},
validatePassword: () => {
return true
}
}
2021-07-16 18:51:38 -07:00
const bchjs = {
Electrumx: {
transactions: () => {},
2022-01-28 08:03:35 -08:00
balance: () => {},
sortAllTxs: () => {}
2021-07-16 18:51:38 -07:00
},
Utxo: {
2022-05-10 10:14:37 -07:00
get: () => {},
isValid: () => true
2021-07-16 18:51:38 -07:00
},
Transaction: {
get: () => {}
},
RawTransactions: {
sendRawTransaction: () => {}
},
encryption: {
getPubKey: () => {}
2022-01-28 08:03:35 -08:00
},
Util: {
chunk100: () => {}
},
PsfSlpIndexer: {
getTokenData: () => {},
getTokenData2: () => {}
2021-07-16 18:51:38 -07:00
}
}
2024-03-22 10:59:22 -07:00
export default { ipfs, localdb, bchjs };