How to use the @casual-simulation/aux-common.createPrecalculatedBot function in @casual-simulation/aux-common

To help you get started, we’ve selected a few @casual-simulation/aux-common examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github casual-simulation / aux / src / aux-vm-browser / managers / BotPanelManager.spec.ts View on Github external
),
                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);
        });
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
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',
                    },
                }),
            ]);
        });
    });
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
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([]);
        });
    });
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
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'],
            ]);
        });
    });
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
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'],
            ]);
        });
    });
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
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);
        });
    });
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
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);
        });
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
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);
        });
github casual-simulation / aux / src / aux-vm-browser / managers / RecentBotManager.spec.ts View on Github external
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',
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
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);
        });
    });