Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
),
botAdded(
createBot('recent', {
hello: false,
})
),
]);
await selection.selectBot(helper.botsState['test'], true, manager);
await selection.selectBot(helper.botsState['test'], true, manager);
manager.isOpen = true;
// botUpdated.next([{ bot: helper.botsState['test'], tags: [] }]);
expect(bots).toEqual([createPrecalculatedBot('empty', {})]);
expect(isOpen).toBe(true);
});
it('should set the aux._editingBot tag on the user bot', async () => {
helper.botsState = {
user: createPrecalculatedBot('user'),
test: createPrecalculatedBot('test'),
};
await helper.setEditingBot(helper.botsState['test']);
expect(vm.events).toEqual([
botUpdated('user', {
tags: {
'aux._editingBot': 'test',
},
}),
]);
});
});
it('should not create a new simulation when one already exists for the given channel ID', async () => {
helper.botsState = {
user: createPrecalculatedBot('user', {
'aux._userSimulationsContext': 'abc',
}),
bot1: createPrecalculatedBot('bot1', {
abc: true,
'aux.channel': 'test',
}),
};
await helper.createSimulation('test', 'bot2');
expect(vm.events).toEqual([]);
});
});
it('should include the bots in the state', () => {
helper.botsState = {
abc: createPrecalculatedBot('abc', {}),
def: createPrecalculatedBot('def', {}),
};
const context = helper.createContext();
expect(context.objects).toEqual([
helper.botsState['abc'],
helper.botsState['def'],
]);
});
});
it('should include the bots in the state', () => {
helper.botsState = {
abc: createPrecalculatedBot('abc', {}),
def: createPrecalculatedBot('def', {}),
};
const context = helper.createContext();
expect(context.objects).toEqual([
helper.botsState['abc'],
helper.botsState['def'],
]);
});
});
it('should return the bot that has the same ID as the user ID', () => {
const state: PrecalculatedBotsState = {
user: createPrecalculatedBot('user', {}),
};
helper.botsState = state;
const user = helper.userBot;
expect(user).toBe(state.user);
});
});
it('should destroy all children of the bot', async () => {
helper.botsState = {
user: createPrecalculatedBot('user'),
bot1: createPrecalculatedBot('bot1'),
bot2: createPrecalculatedBot('bot2', {
'aux.creator': 'bot1',
}),
};
const result = await helper.destroyBot(helper.botsState['bot1']);
expect(vm.events).toEqual([botRemoved('bot1'), botRemoved('bot2')]);
expect(result).toBe(true);
});
it('should destroy the given bot', async () => {
helper.botsState = {
user: createPrecalculatedBot('user'),
bot1: createPrecalculatedBot('bot1'),
};
const result = await helper.destroyBot(helper.botsState['bot1']);
expect(vm.events).toEqual([botRemoved('bot1')]);
expect(result).toBe(true);
});
it('should ignore context tags', () => {
helper.botsState = {
context: createPrecalculatedBot('context', {
'aux.context': 'abc',
}),
};
let bot1 = createBot('testId1', {
abc: true,
'abc.x': 1,
'abc.y': 2,
'abc.index': 100,
def: true,
});
recent.addBotDiff(bot1);
expect(recent.bot).toEqual({
id: 'mod',
it('should return the bot with the globals ID', () => {
const state: PrecalculatedBotsState = {
[GLOBALS_BOT_ID]: createPrecalculatedBot(GLOBALS_BOT_ID, {}),
};
helper.botsState = state;
const bot = state[GLOBALS_BOT_ID];
const globals = helper.globalsBot;
expect(globals).toBe(bot);
});
});