mirror of
https://github.com/coderaiser/cloudcmd.git
synced 2026-01-23 02:35:49 +00:00
fix(distribute) export: config
This commit is contained in:
parent
2d7722c19f
commit
0c5bde5a89
2 changed files with 31 additions and 1 deletions
|
|
@ -36,7 +36,7 @@ const omitList = [
|
|||
'configDialog',
|
||||
];
|
||||
|
||||
const omitConfig = wraptile((config) => omit(config, omitList));
|
||||
const omitConfig = (config) => omit(config, omitList);
|
||||
|
||||
module.exports = (socket) => {
|
||||
if (!config('export'))
|
||||
|
|
|
|||
|
|
@ -43,3 +43,33 @@ test('distribute: export', async (t) => {
|
|||
});
|
||||
});
|
||||
|
||||
test('distribute: export: config', async (t) => {
|
||||
const defaultConfig = {
|
||||
export: true,
|
||||
exportToken: 'a',
|
||||
vim: true,
|
||||
log: false,
|
||||
};
|
||||
|
||||
const {port, done} = await connect({
|
||||
config: defaultConfig
|
||||
});
|
||||
|
||||
const url = `http://localhost:${port}/distribute?port=${1111}`;
|
||||
const socket = io.connect(url);
|
||||
|
||||
const name = config('name');
|
||||
|
||||
socket.on('connect', () => {
|
||||
socket.emit('auth', 'a');
|
||||
});
|
||||
|
||||
socket.on('config', async (data) => {
|
||||
socket.close();
|
||||
await done();
|
||||
|
||||
t.equal(typeof data, 'object', 'should emit object');
|
||||
t.end();
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue