1
0
mirror of https://github.com/hack-chat/main.git synced 2024-03-22 13:20:33 +08:00
hack-chat-main/test/mockImports.js

126 lines
2.3 KiB
JavaScript
Raw Permalink Normal View History

2022-06-23 00:32:51 +08:00
const mocks = {
core: {
sessionKey: 'test',
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
appConfig: {
data: {
globalMods: [],
permissions: [],
channels: {
test: {
owned: false,
}
},
tripSalt: 'test',
adminTrip: '',
},
write: async () => '',
},
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
muzzledHashes: [],
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
stats: {
increment: () => 1,
decrement: () => 1,
get: () => 1,
set: () => 1,
},
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
dynamicImports: {
reloadDirCache: () => '',
},
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
commands: {
reloadCommands: () => '',
2023-12-22 15:14:03 +08:00
handleCommand: () => '',
2022-06-23 00:32:51 +08:00
commands: [],
categoriesList: ['test'],
all: () => [{
info: {
name: 'test',
category: 'test',
},
}],
get: (name) => {
if (name === 'undef') {
return undefined;
} else if(name === 'noalias') {
return {
info: {
name: 'test',
category: 'test',
}
}
} else {
return {
info: {
name: 'test',
category: 'test',
aliases: ['testing'],
}
}
}
},
},
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
configManager: {
save: () => true,
},
},
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
server : {
police: {
addresses: [],
frisk: () => false,
arrest: (address) => mocks.server.police.addresses.push(address),
},
findSockets: () => [],
reply: () => true,
broadcast: (data, filterObj) => {
if (typeof filterObj.level === 'function') {
filterObj.level();
}
return true;
},
send: () => true,
cmdKey: 'test',
registerHook: () => true,
loadHooks: () => true,
clients: [{
channel: 'cake',
address: '127.0.0.1',
}],
getSocketHash: () => 'test',
},
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
plebSocket: {
level: 100,
address: '127.0.0.1',
channel: 'cake',
channels: [],
terminate: () => true,
nick: 'lies',
hcProtocol: 2,
hash: 'testHash',
uType: 'user',
userid: 1234,
},
2023-12-22 15:14:03 +08:00
2022-06-23 00:32:51 +08:00
authedSocket: {
level: 9999999,
address: '127.0.0.1',
channel: 'cake',
channels: [],
terminate: () => true,
hcProtocol: 2,
nick: '[ignore this]',
trip: 'and this',
hash: 'testHash',
uType: 'admin',
userid: 1234,
},
};
export default mocks;