How to use the @casual-simulation/aux-common.createBot 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 / RecentBotManager.spec.ts View on Github external
it('should ignore well known tags', () => {
            let bot1 = createBot('testId1', {
                test: 'abc',
                'aux._destroyed': true,
            });

            recent.addBotDiff(bot1);

            expect(recent.bot).toEqual({
                id: 'mod',
                precalculated: true,
                tags: {
                    test: 'abc',
                },
                values: {
                    test: 'abc',
                },
            });
github casual-simulation / aux / src / aux-vm / partitions / MemoryPartition.spec.ts View on Github external
it('should send an onBotsAdded event for all the bots in the partition on init', async () => {
            const mem = createMemoryPartition({
                type: 'memory',
                initialState: {
                    test: createBot('test'),
                    test2: createBot('test2'),
                },
            });

            let added: Bot[] = [];
            mem.onBotsAdded.subscribe(e => added.push(...e));

            expect(added).toEqual([createBot('test'), createBot('test2')]);
        });
    });
github casual-simulation / aux / src / aux-vm / partitions / MemoryPartition.spec.ts View on Github external
it('should send an onBotsAdded event for all the bots in the partition on init', async () => {
            const mem = createMemoryPartition({
                type: 'memory',
                initialState: {
                    test: createBot('test'),
                    test2: createBot('test2'),
                },
            });

            let added: Bot[] = [];
            mem.onBotsAdded.subscribe(e => added.push(...e));

            expect(added).toEqual([createBot('test'), createBot('test2')]);
        });
    });
github casual-simulation / aux / src / aux-vm / partitions / MemoryPartition.spec.ts View on Github external
it('should send an onBotsAdded event for all the bots in the partition on init', async () => {
            const mem = createMemoryPartition({
                type: 'memory',
                initialState: {
                    test: createBot('test'),
                    test2: createBot('test2'),
                },
            });

            let added: Bot[] = [];
            mem.onBotsAdded.subscribe(e => added.push(...e));

            expect(added).toEqual([createBot('test'), createBot('test2')]);
        });
    });
github casual-simulation / aux / src / aux-vm-browser / managers / RecentBotManager.spec.ts View on Github external
it('should move reused IDs to the front of the list with the new value', () => {
            let bot1 = createBot('testId1', {
                test: 'abc',
                'aux.color': 'red',
            });
            let bot2 = createBot('testId2', {
                test: 'abc',
                'aux.color': 'green',
            });
            let bot3 = createBot('testId3', {
                test: 'abc',
                'aux.color': 'blue',
            });
            let bot1_2 = createBot('testId1', {
                test1: '999',
                'aux.color': 'magenta',
            });

            recent.addBotDiff(bot1);
            recent.addBotDiff(bot2);
            recent.addBotDiff(bot3);
            recent.addBotDiff(bot1_2);

            expect(recent.bot).toEqual({
                id: 'mod',
                precalculated: true,
github casual-simulation / aux / src / aux-vm / partitions / RemoteCausalRepoPartition.spec.ts View on Github external
it('should send removed atoms to the repo', async () => {
                partition.connect();

                await partition.applyEvents([
                    botAdded(
                        createBot('newBot', {
                            abc: 'def',
                        })
                    ),
                ]);

                await partition.applyEvents([
                    botUpdated('newBot', {
                        tags: {
                            abc: '123',
                        },
                    }),
                ]);

                const addedAtoms = flatMap(
                    connection.sentMessages.filter(m => m.name === ADD_ATOMS),
                    m => m.data.atoms
github casual-simulation / aux / src / aux-vm-browser / managers / RecentBotManager.spec.ts View on Github external
it('should trim to the max length', () => {
            let bot1 = createBot('testId1', {
                test: 'abc',
                'aux.color': 'red',
            });
            let bot2 = createBot('testId2', {
                test: 'abc',
                'aux.color': 'green',
            });
            let bot3 = createBot('testId3', {
                test: 'abc',
                'aux.color': 'blue',
            });
            let bot4 = createBot('testId4', {
                test: 'abc',
                'aux.color': 'magenta',
            });
            let bot5 = createBot('testId5', {
                test: 'abc',
                'aux.color': 'yellow',
            });
            let bot6 = createBot('testId6', {
github casual-simulation / aux / src / aux-vm-browser / managers / RecentBotManager.spec.ts View on Github external
it('should move reused IDs to the front of the list with the new value', () => {
            let bot1 = createBot('testId1', {
                test: 'abc',
                'aux.color': 'red',
            });
            let bot2 = createBot('testId2', {
                test: 'abc',
                'aux.color': 'green',
            });
            let bot3 = createBot('testId3', {
                test: 'abc',
                'aux.color': 'blue',
            });
            let bot1_2 = createBot('testId1', {
                test1: '999',
                'aux.color': 'magenta',
            });

            recent.addBotDiff(bot1);
            recent.addBotDiff(bot2);
            recent.addBotDiff(bot3);
            recent.addBotDiff(bot1_2);

            expect(recent.bot).toEqual({
                id: 'mod',
                precalculated: true,
                tags: {
                    ...bot1_2.tags,
                },
                values: {
github casual-simulation / aux / src / aux-vm-browser / managers / RecentBotManager.spec.ts View on Github external
test: 'abc',
                'aux.color': 'red',
            });
            let bot2 = createBot('testId2', {
                test: 'abc',
                'aux.color': 'green',
            });
            let bot3 = createBot('testId3', {
                test: 'abc',
                'aux.color': 'blue',
            });
            let bot4 = createBot('testId4', {
                test: 'abc',
                'aux.color': 'magenta',
            });
            let bot5 = createBot('testId5', {
                test: 'abc',
                'aux.color': 'yellow',
            });
            let bot6 = createBot('testId6', {
                test: 'abc',
                'aux.color': 'cyan',
            });

            recent.addBotDiff(bot1);
            recent.addBotDiff(bot2);
            recent.addBotDiff(bot3);
            recent.addBotDiff(bot4);
            recent.addBotDiff(bot5);
            recent.addBotDiff(bot6);

            expect(recent.bot).toEqual({
github casual-simulation / aux / src / aux-vm / managers / BotHelper.spec.ts View on Github external
'aux._userSimulationsContext': 'abc',
                }),
            };

            await helper.createSimulation('test', 'botId');
            await helper.createSimulation('test2', 'botId2');

            expect(vm.events).toEqual([
                botAdded(
                    createBot('botId', {
                        abc: true,
                        'aux.channel': 'test',
                    })
                ),
                botAdded(
                    createBot('botId2', {
                        abc: true,
                        'aux.channel': 'test2',
                    })
                ),
            ]);
        });