config#describeProxy TypeScript Examples

The following examples show how to use config#describeProxy. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: hashing.test.ts    From hyperhyperspace-core with MIT License 6 votes vote down vote up
describeProxy('[HSH] Hashing', () => {
    test('[HSH01] SHA256 test', () => {
        let sha = new SHAImpl() as SHA;
        let message = 'say hi to the sha';
        let hash    = sha.sha256hex(message);
        let correctHash = 'cc2a21bc5a8456cca36023a867bec833dc9a4cae7186ec03fabc0655da8c9787';
        expect(hash).toEqual(correctHash);
    });

    test('[HSH02] RMD160 test', () => {
        let rmd = new RMDImpl() as RMD;
        let message = 'say hi to the sha';
        let hash    = rmd.rmd160hex(message);
        let correctHash = 'ec483cf2d838bb73dfd999975b5a2110083d64ed';
        expect(hash).toEqual(correctHash);
    });
});
Example #2
Source File: random.test.ts    From hyperhyperspace-core with MIT License 6 votes vote down vote up
describeProxy('[RNG] Pseudo-randomness', () => {
    test('[RNG01] Basic RNG length test', () => {
        let rng : RNG = new RNGImpl();
        for (let i=0; i<16; i++) {
            expect(rng.randomHexString(64).length).toEqual(64 / 4);
            expect(rng.randomHexString(4).length).toEqual(4 / 4);
        }

    })
});
Example #3
Source File: network.test.ts    From hyperhyperspace-core with MIT License 6 votes vote down vote up
describeProxy('[NET] Basic networking', () => {

    test('[NET01] 2-node network test (wrtc)', async (done) => {

        await twoNodeNetworkTest(linkupServer, linkupServer, done);

    }, 45000);

    test('[NET02] 2-node network test (ws)', async (done) => {

        await twoNodeNetworkTest('ws://localhost:10110', 'ws://localhost:10111', done);

    }, 45000);

    test('[NET03] 2-node network test (mixed)', async (done) => {

        await twoNodeNetworkTest( 'ws://localhost:10112', linkupServer, done);

    }, 45000);
});
Example #4
Source File: wordcoding.test.ts    From hyperhyperspace-core with MIT License 5 votes vote down vote up
describeProxy('[WCO] Word-coding', () => {
    test('[WCO01] Encode-deocde test: English', () => {
        testWordCode(WordCode.english);
    });
    test('[WCO02] Encode-decode test: Spanish', () => {
        testWordCode(WordCode.spanish);
    })
});
Example #5
Source File: peer.test.ts    From hyperhyperspace-core with MIT License 5 votes vote down vote up
//import { Logger, LogLevel } from 'util/logging';

describeProxy('[PGM] Peer group management', () => {
    test('[PGM01] 2-peer group set up (wrtc)', async (done) => {

        await twoPeerGroupTest(done, 'wrtc', 'no-discovery');
        
    }, 300000);

    test('[PGM02] 2-peer group set up (ws)', async (done) => {

        await twoPeerGroupTest(done, 'ws', 'no-discovery', 6000);

    }, 300000);

    test('[PGM03] 2-peer group set up (mix)', async (done) => {

        await twoPeerGroupTest(done, 'mix', 'no-discovery', 6100);

    }, 300000);

    test('[PGM04] 2-peer group set up (wrtc) with peer discovery', async (done) => {

        await twoPeerGroupTest(done, 'wrtc', 'linkup-discovery');

    }, 300000);

    test('[PGM05] 4-peer group clique set up (wrtc)', async (done) => {

        await fourPeerCliqueGroupTest(done, 'wrtc', 'no-discovery');

    }, 300000);

    test('[PGM06] 4-peer group clique set up (ws)', async (done) => {

        await fourPeerCliqueGroupTest(done, 'ws', 'no-discovery', 7000);

    }, 300000);

    test('[PGM07] 4-peer group clique set up (mix)', async (done) => {

        await fourPeerCliqueGroupTest(done, 'mix', 'no-discovery', 6110);

    }, 300000);

    test('[PGM08] 4-peer group clique set up (wrtc) with peer discovery', async (done) => {

        await fourPeerCliqueGroupTest(done, 'wrtc', 'linkup-discovery');

    }, 400000);

    test('[PGM09] 4-peer group clique set up (wrtc) with peer discovery and a shared secret', async (done) => {

        await fourPeerCliqueGroupTest(done, 'wrtc', 'linkup-discovery-secret');

    }, 400000);
});
Example #6
Source File: state.test.ts    From hyperhyperspace-core with MIT License 5 votes vote down vote up
//import { SQLiteBackend } from '../../../../sqlite/dist';

describeProxy;
Example #7
Source File: state.test.ts    From hyperhyperspace-core with MIT License 5 votes vote down vote up
describeProxy('[SYN] State sync', () => {
    test('[SYN01] Gossip agent in small peer group (wrtc)', async (done) => {

        await gossipInSmallPeerGroup(done, 'wrtc');

    }, 300000);

    test('[SYN02] Gossip agent in small peer group (ws)', async (done) => {

        await gossipInSmallPeerGroup(done, 'ws', 5200);

    }, 300000);

    test('[SYN03] Gossip agent in small peer group (mix)', async (done) => {

        await gossipInSmallPeerGroup(done, 'mix', 5210);

    }, 300000);

    test('[SYN04] Causal history agent-based set sync in small peer group (wrtc)', async (done) => {

        await syncInSmallPeerGroup(done, 'wrtc');

    }, 300000);

    test('[SYN05] Causal history agent-based set sync in small peer group (ws)', async (done) => {

        await syncInSmallPeerGroup(done, 'ws', 5300);
    }, 300000);

    test('[SYN06] Causal history agent-based set sync in small peer group (mix)', async (done) => {

        await syncInSmallPeerGroup(done, 'mix', 5310);
    }, 300000);

    test('[SYN07] Causal history agent-based set sync in small peer group (wrtc) w/remoting', async (done) => {

        await syncInSmallPeerGroup(done, 'wrtc', undefined, true);

    }, 300000);

    test('[SYN08] Causal history agent-based set staged sync in small peer group (wrtc)', async (done) => {

        await stagedSyncInSmallPeerGroup(done, 'wrtc');

    }, 300000);

    test('[SYN09] Causal history agent-based set deep sync in small peer group with faulty network (wrtc)', async (done) => {

        await deepSyncInSmallPeerGroup(done, 'wrtc', undefined, undefined, true);

    }, 300000);

    test('[SYN10] Causal history agent-based set diamond-shaped sync in small peer group (wrtc)', async (done) => {

        await diamondSyncInSmallPeerGroup(done, 'wrtc');

    }, 300000);

    test('[SYN11] Causal history agent-based set deep sync in small peer group (wrtc)', async (done) => {

        await deepSyncInSmallPeerGroup(done, 'wrtc', undefined, undefined);

    }, 300000);

    test('[SYN12] Causal history agent-based set sync in small peer group (wrtc) using big objects', async (done) => {

        await syncInSmallPeerGroup(done, 'wrtc', undefined, undefined, undefined, true);

    }, 300000);

});
Example #8
Source File: ciphers.test.ts    From hyperhyperspace-core with MIT License 4 votes vote down vote up
describeProxy('[ENC] Ciphers', () => {
    test('[ENC01] chacha20 self test', () => {
        let chacha = new ChaCha20Impl() as ChaCha20;
        
        let message = 'hey dude, dont make it bad';
        let key   = "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f";
        let nonce = "000102030405060708090a0b";

        let cipher = chacha.encryptHex(message, key, nonce);
        expect(chacha.decryptHex(cipher, key, nonce)).toEqual(message);

        let wrongKey = "ff0102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f";
        expect(chacha.decryptHex(cipher, wrongKey, nonce)).not.toEqual(message);


        let wrongNonce = "ff0102030405060708090a0b";
        expect(chacha.decryptHex(cipher, key, wrongNonce)).not.toEqual(message);
    });

    test('[ENC02] chacha20 encrypt test', () => {
        let chacha = new ChaCha20Impl() as ChaCha20;
        let key = "00000000000000000000000000000000" +
                  "00000000000000000000000000000000"; 
        let nonce = "000000000000000000000000";
        let message = Buffer.from("00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "hex").toString();
        expect(chacha.encryptHex(message, key, nonce)).toEqual("76b8e0ada0f13d90405d6ae55386bd28bdd219b8a08ded1aa836efcc8b770dc7da41597c5157488d7724e03fb8d84a376a43b8f41518a11cc387b669b2ee6586");
    });

    test('[ENC03] RSA self test', async () => {

        let rsa = new RSADefaults.impl() as RSA;
        await rsa.loadKeyPair(publicKey, privateKey);

        let rsaPublic = new RSADefaults.impl() as RSA;
        await rsaPublic.loadKeyPair(publicKey);

        let message = 'â‚¿â‚¿â‚¿ this is a small text message ?';

        let ciphertext = await rsaPublic.encrypt(message);

        expect(await rsa.decrypt(ciphertext)).toEqual(message);

        let signature = await rsa.sign(message);
        expect(await rsaPublic.verify(message, signature)).toEqual(true);

        let wrongSignature = "NU6k7ilRspYc6O7fUvGOnPdS7VkW3e1nYsrz6MflCUSNffTCpH/tS3J+2fvICWqN9dkCYXE/La969Gsod5nIPbonxvzNHpJKW/7Dnn2q62AN+k3ZFOGJ17qLrAu1mg9bcu4B0m3cbwrNLdUV1MBWp4poQI5bn8uM+A1IkdOLOFyyeWSgrlWstc2RvTnZlKR5Dk4F/kZMh4tzfC3sbktlirk7IbT0HvlU4V2hpu6lx3uw2wRbvH8CGTavToQeBI/StPh98JDZcdaB7nfWYZ2MIBwt9NpXQvcoaUuee4T7UkynIgYngmnmZnD/X9/WP0kO7tWa89I6uOVsiWowOBYsew==";
        expect(await rsaPublic.verify(message, wrongSignature)).toEqual(false);
    });

    test('[ENC04] RSA self test - force WebCrypto', async () => {

        let rsa = new WebCryptoRSA() as RSA;
        await rsa.loadKeyPair(publicKey, privateKey);

        let rsaPublic = new WebCryptoRSA() as RSA;
        await rsaPublic.loadKeyPair(publicKey);

        let message = 'â‚¿â‚¿â‚¿ this is a small text message ?';

        let ciphertext = await rsaPublic.encrypt(message);

        expect(await rsa.decrypt(ciphertext)).toEqual(message);

        let signature = await rsa.sign(message);
        expect(await rsaPublic.verify(message, signature)).toEqual(true);

        let wrongSignature = "NU6k7ilRspYc6O7fUvGOnPdS7VkW3e1nYsrz6MflCUSNffTCpH/tS3J+2fvICWqN9dkCYXE/La969Gsod5nIPbonxvzNHpJKW/7Dnn2q62AN+k3ZFOGJ17qLrAu1mg9bcu4B0m3cbwrNLdUV1MBWp4poQI5bn8uM+A1IkdOLOFyyeWSgrlWstc2RvTnZlKR5Dk4F/kZMh4tzfC3sbktlirk7IbT0HvlU4V2hpu6lx3uw2wRbvH8CGTavToQeBI/StPh98JDZcdaB7nfWYZ2MIBwt9NpXQvcoaUuee4T7UkynIgYngmnmZnD/X9/WP0kO7tWa89I6uOVsiWowOBYsew==";
        expect(await rsaPublic.verify(message, wrongSignature)).toEqual(false);
    });

    /*test('[ENC05] RSA self test - force NodeRSA', async () => {

        let rsa = new NodeRSA() as RSA;
        await rsa.loadKeyPair(publicKey, privateKey);

        let rsaPublic = new NodeRSA() as RSA;
        await rsaPublic.loadKeyPair(publicKey);

        let message = 'â‚¿â‚¿â‚¿ this is a small text message ?';

        let ciphertext = await rsaPublic.encrypt(message);

        expect(await rsa.decrypt(ciphertext)).toEqual(message);

        let signature = await rsa.sign(message);
        expect(await rsaPublic.verify(message, signature)).toEqual(true);

        let wrongSignature = "NU6k7ilRspYc6O7fUvGOnPdS7VkW3e1nYsrz6MflCUSNffTCpH/tS3J+2fvICWqN9dkCYXE/La969Gsod5nIPbonxvzNHpJKW/7Dnn2q62AN+k3ZFOGJ17qLrAu1mg9bcu4B0m3cbwrNLdUV1MBWp4poQI5bn8uM+A1IkdOLOFyyeWSgrlWstc2RvTnZlKR5Dk4F/kZMh4tzfC3sbktlirk7IbT0HvlU4V2hpu6lx3uw2wRbvH8CGTavToQeBI/StPh98JDZcdaB7nfWYZ2MIBwt9NpXQvcoaUuee4T7UkynIgYngmnmZnD/X9/WP0kO7tWa89I6uOVsiWowOBYsew==";
        expect(await rsaPublic.verify(message, wrongSignature)).toEqual(false);
    });

    test('[ENC06] RSA check interop NodeRSA <--> WebCryptoRSA', async () => {

        let rsa = new NodeRSA() as RSA;
        await rsa.generateKey(2048);
        let rsaPublic = new NodeRSA() as RSA;
        await rsaPublic.loadKeyPair(rsa.getPublicKey());

        let rsa2 = new WebCryptoRSA() as RSA;
        await rsa2.loadKeyPair(rsa.getPublicKey(), rsa.getPrivateKey());

        let rsaPublic2 = new WebCryptoRSA() as RSA;
        await rsaPublic2.loadKeyPair(rsa2.getPublicKey());

        let message = 'â‚¿â‚¿â‚¿ this is a small text message ?';

        let ciphertext = await rsaPublic.encrypt(message);
        expect(await rsa2.decrypt(ciphertext)).toEqual(message);

        let signature = await rsa2.sign(message);
        expect(await rsaPublic.verify(message, signature)).toEqual(true);

        let ciphertext2 = await rsaPublic2.encrypt(message);
        expect(await rsa.decrypt(ciphertext2)).toEqual(message);

        let signature2 = await rsa.sign(message);
        expect(await rsaPublic2.verify(message, signature2)).toEqual(true);

    });*/
});
Example #9
Source File: model.test.ts    From hyperhyperspace-core with MIT License 4 votes vote down vote up
describeProxy('[MOD] Data model', () => {

    test( '[MOD01] Basic types', () => {
        
        const original = ['hello', 1.0, false, 2.5, 'bye', true];
        const context = new Context();
        const literalization  = HashedObject.literalizeField('original', original, context);
        const reconstructed = HashedObject.deliteralizeField(literalization.value, context);

        for (let i=0; i<original.length; i++) {
            expect(original[i]).toEqual(reconstructed[i]);
        }
    });

    test('[MOD02] Hashed sets', () => {
        
        const set1 = new HashedSet();
        const set2 = new HashedSet();

        const elements = [1, 2, 3, 4, 'five', 'six', true];

        for (let element of elements) {
            set1.add(element);
            set2.add(element);
        }

        const literal1 = HashedObject.literalizeField('set1', set1);
        const literal2 = HashedObject.literalizeField('set2', set2);

        expect(Serialization.default(literal1.value)).toEqual(Serialization.default(literal2.value));
        
        expect(set1.has('five')).toBeTruthy();
        expect(set1.has('seven')).toBeFalsy();
    });

    test('[MOD03] Hashed maps', () => {

        const map1 = new HashedMap();
        const map2 = new HashedMap();

        const items = [['a', 'five'], ['b', 'three']];

        for (let item of items) {
            map1.set(item[0], item[1]);
            map2.set(item[0], item[1]);
        }

        expect(map1.equals(map2)).toBeTruthy();

        map1.set('a', 'nonsense');

        expect(map1.equals(map2)).toBeFalsy();

        const literal1 = map2.literalize();

        const map3 = HashedMap.deliteralize(literal1.value, new Context());

        expect(map2.equals(map3)).toBeTruthy();
    });

    test('[MOD04] HashedObject subclasses', () => {


        let os = createHashedObjects();

        let a: SomethingHashed = os.a;

        let a2 = a.clone();

        expect(a.equals(a2)).toBeTruthy();

        a.reference = undefined;

        expect(a.equals(a2)).toBeFalsy();
    });

    test('[MOD05] Id override', () => {

        let a = new OverrideIds('hello, world!', true);
        let b = new OverrideIds('hello, world!', true);
        let c = new OverrideIds('hello, world!', false);

        expect(a.equals(b)).toBeTruthy();
        expect(a.equals(c)).toBeFalsy();

    });
});
Example #10
Source File: group.test.ts    From hyperhyperspace-core with MIT License 4 votes vote down vote up
describeProxy('[SPA] Group shared spaces', () => {

    
    test('[SPA01] 3-node sync test', async (done) => {

        const size = 3;

        let spaceId = new RNGImpl().randomHexString(32);

        let samplePeers = await generateSamplePeers(size);
        let spaces      = generateSpacesForPeers(spaceId, samplePeers);


        for (let i=0; i<size; i++) {
            let samplePeer = samplePeers[i];
            let space = spaces[i];

            space.connect();

            let peers = new MutableSet();
            await space.attach('peers', peers);
            await peers.add(samplePeer);
            await peers.saveQueuedOps();

            let data = new MutableSet();
            await space.attach('data', data);
            
        }

        let peers = await spaces[1].get('peers') as MutableSet<SamplePeer>;

        let logger = new Logger('3-sync test');
        logger.setLevel(LogLevel.INFO);


        //connectSpaceWithLogger(spaces[0], logger);
    
        /*{
            let peersSync = spaces[0].syncAgents.get(peers.hash()) as TerminalOpsSyncAgent;
            peersSync;
            peersSync.controlLog     = logger;
            peersSync.peerMessageLog = logger;
            peersSync.opTransferLog  = logger;
        }*/   

        await new Promise(r => setTimeout(r, 50));

        await peers.loadAllChanges();

        let ticks = 0;
        while (((spaces[0].mesh.pod.getAgent(PeerGroupAgent.agentIdForPeerGroup(spaces[0].spaceId)) as PeerGroupAgent).getPeers().length < size-1 || 
               peers.size() < size) 
               && ticks++ < 800) {
            await new Promise(r => setTimeout(r, 50));
            await peers.loadAllChanges();
            //console.log(ticks);
            
            //let pc = (spaces[0].mesh.pod.getAgent(PeerMeshAgent.agentIdForMesh(spaces[0].spaceId)) as PeerMeshAgent).getPeers().length;
            //console.log('peers: ' + pc);
        }

        expect((spaces[0].mesh.pod.getAgent(PeerGroupAgent.agentIdForPeerGroup(spaces[0].spaceId)) as PeerGroupAgent).getPeers().length).toEqual(size-1);
        expect(peers.size()).toEqual(size);
        
        for (const space of spaces) {
            space.mesh.pod.shutdown();
        }
        
        done();
        
    }, 300000);

test('[SPA02] 2-node nested sync test', async (done) => {

    const size = 2;

    let spaceId = new RNGImpl().randomHexString(32);

    let samplePeers = await generateSamplePeers(size);
    let spaces      = generateSpacesForPeers(spaceId, samplePeers);


    for (let i=0; i<size; i++) {
        let space = spaces[i];

        let things = new MutableSet();
        space.connect();
        await space.attach('things', things);
        
    }

    let things = await spaces[0].get('things') as MutableSet<MutableSet<SamplePeer>>;

    let inner = new MutableSet<SamplePeer>();

    await things.add(inner);
    await things.saveQueuedOps();

    await inner.add(samplePeers[0]);
    await inner.saveQueuedOps();

    let logger = new Logger('2-way nested sync test');
    logger.setLevel(LogLevel.INFO);

    //startSpaceWithLogger(spaces[0], logger);  

    /*{
        let logger = new Logger('things sync');
        logger.setLevel(LogLevel.TRACE);
        let peersSync = spaces[0].syncAgents.get(things.hash()) as TerminalOpsSyncAgent;
        peersSync;
        peersSync.controlLog     = logger;
        peersSync.peerMessageLog = logger;
        peersSync.opTransferLog  = logger;
    }   

    {
        let logger = new Logger('inner sync');
        logger.setLevel(LogLevel.TRACE);
        let peersSync = spaces[0].syncAgents.get(inner.hash()) as TerminalOpsSyncAgent;
        peersSync;
        peersSync.controlLog     = logger;
        peersSync.peerMessageLog = logger;
        peersSync.opTransferLog  = logger;
    } */


    let lastThings = spaces[size-1].get('things') as MutableSet<MutableSet<SamplePeer>>;
    lastThings.loadAllChanges();

    let ticks = 0;
    while (ticks++ < 1200 && lastThings.size() < 1) {
        await new Promise(r => setTimeout(r, 50));
        await lastThings?.loadAllChanges();
        //console.log('T'+ticks);
    }

    expect(lastThings.size()).toEqual(1);

    let lastInner = lastThings?.size() > 0 ? lastThings.values().next().value : undefined;

    ticks = 0;
    while (lastInner !== undefined && ticks++ < 1200 && (lastInner?.size() === 0)) {
        await new Promise(r => setTimeout(r, 50));
        await lastInner.loadAllChanges();
        //console.log('I'+ticks);
    }

    let samplePeer = lastInner?.size() > 0 ? lastInner.values().next().value : undefined;

    //expect((spaces[0].mesh.pod.getAgent(PeerGroupAgent.agentIdForPeerGroup(spaces[0].spaceId)) as PeerGroupAgent).getPeers().length).toEqual(size-1);
    
    expect(lastInner.size()).toEqual(1);
    expect(samplePeer?.hash()).toEqual(samplePeers[0].hash());

    for (const space of spaces) {
        space.mesh.pod.shutdown();
    }

    done();
}, 300000);
});
Example #11
Source File: linkup.test.ts    From hyperhyperspace-core with MIT License 4 votes vote down vote up
describeProxy('[LNK] Single-host LinkupManager', () => {
    test('[LNK01] Call starting', (done) => {
        let linkupManager1 = new LinkupManager();
        let linkupManager2 = new LinkupManager();

        const rnd = new RNGImpl().randomHexString(64);

        let address1 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressOne_A_' + rnd);
        let address2 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressTwo_A_' + rnd);

        let callId = 'DUMMY_CALL_ID_TEST_A';
        let message = 'MESSAGE_' + rnd;

        // one is going to listen for a message in a new call
        // two is going to send a message in a new call DUMMY_CALL_ID_TEST_A

        let int:any = undefined;

        linkupManager1.listenForMessagesNewCall(address1, (sender: LinkupAddress, recipient: LinkupAddress, rcvdCallId: string, rcvdInstanceId: string, rcvdMessage: any) => {
            
            expect(sender.linkupId).toEqual(address2.linkupId);
            expect(sender.serverURL).toEqual(address2.serverURL);
            expect(recipient.linkupId).toEqual(address1.linkupId);
            expect(recipient.serverURL).toEqual(address1.serverURL);
            expect(rcvdCallId).toEqual(callId);
            expect(rcvdInstanceId).toBeDefined();
            expect(rcvdMessage).toEqual(message);
            if (int !== undefined) { clearInterval(int); }
            linkupManager1.shutdown();
            linkupManager2.shutdown();
            done();
        });
        
        int = window.setInterval(() => {
            linkupManager2.sendMessageOnCall(address2, address1, callId, message);
        }, 100);

        

    }, 40000);

    test('[LNK02] Call answering', (done) => {
        let linkupManager1 = new LinkupManager();
        let linkupManager2 = new LinkupManager();

        const rnd = new RNGImpl().randomHexString(64);

        let address1 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressOne_B_' + rnd);
        let address2 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressTwo_B_' + rnd);

        let callId =  'DUMMY_CALL_ID_TEST_B';
        let message = 'MESSAGE_' + rnd;
        let reply   = 'REPLY';

        // one is going to listen for a message in a new call
        // two is going to send a message in a new call DUMMY_CALL_ID_TEST_B
        // one is going to send a message back on call DUMMT_CALL_ID_TEST_B

        let int:any = undefined;

        linkupManager1.listenForMessagesNewCall(address1, (sender: LinkupAddress, recipient: LinkupAddress, rcvdCallId: string, rcvdInstanceId: string, rcvdMessage: any) => {
            
            expect(sender.linkupId).toEqual(address2.linkupId);
            expect(sender.serverURL).toEqual(address2.serverURL);
            expect(recipient.linkupId).toEqual(address1.linkupId);
            expect(recipient.serverURL).toEqual(address1.serverURL);
            expect(rcvdCallId).toEqual(callId);
            expect(rcvdInstanceId).toBeDefined();
            expect(rcvdMessage).toEqual(message);
            linkupManager1.sendMessageOnCall(address1, address2, callId, reply);
            
        });

        linkupManager2.listenForMessagesOnCall(address2, callId, (instanceId: string, message: string) => {
            expect(instanceId).toBeDefined();
            expect(message).toEqual(reply);
            if (int !== undefined) { clearInterval(int); }
            linkupManager1.shutdown();
            linkupManager2.shutdown();
            done();
        });
        
        int = window.setInterval(() => {
            linkupManager2.sendMessageOnCall(address2, address1, callId, message);
        }, 100);

        

    }, 40000);

    test('[LNK03] Raw messaging', (done) => {
        let linkupManager1 = new LinkupManager();
        let linkupManager2 = new LinkupManager();

        const rnd = new RNGImpl().randomHexString(64);

        let address1 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressOne_C_' + rnd);
        let address2 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressTwo_C_' + rnd);

        let message = 'MESSAGE_' + rnd;

        let int: any = undefined;

        linkupManager1.listenForRawMessages(address1, (sender: LinkupAddress, recipient: LinkupAddress, rcvdMessage: any) => {
            expect(sender.linkupId).toEqual(address2.linkupId);
            expect(sender.serverURL).toEqual(address2.serverURL);
            expect(recipient.linkupId).toEqual(address1.linkupId);
            expect(recipient.serverURL).toEqual(address1.serverURL);
            expect(rcvdMessage).toEqual(message);
            if (int !== undefined) { clearInterval(int); }
            linkupManager1.shutdown();
            linkupManager2.shutdown();
            done();
        });

        int = window.setInterval(() => {
            linkupManager2.sendRawMessage(address2, address1, message);
        }, 100);
    }, 40000);


    test('[LNK04] Call starting w/proxy', (done) => {


            let eventCallback = (ev: LinkupManagerEvent) =>  {
                linkupManager1.linkupManagerEventIngestFn(ev);
            }

            let linkupManager1Host = new LinkupManagerHost(eventCallback);

            let commandForwardingFn = (cmd: LinkupManagerCommand) => {
                linkupManager1Host.execute(cmd);
            }

            let linkupManager1 = new LinkupManagerProxy(commandForwardingFn);
            let linkupManager2 = new LinkupManager();
    
            const rnd = new RNGImpl().randomHexString(64);
    
            let address1 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressOne_A_' + rnd);
            let address2 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressTwo_A_' + rnd);
    
            let callId = 'DUMMY_CALL_ID_TEST_A';
            let message = 'MESSAGE_' + rnd;
    
            // one is going to listen for a message in a new call
            // two is going to send a message in a new call DUMMY_CALL_ID_TEST_A
    
            let int:any = undefined;
    
            linkupManager1.listenForMessagesNewCall(address1, (sender: LinkupAddress, recipient: LinkupAddress, rcvdCallId: string, rcvdInstanceId: string, rcvdMessage: any) => {
                
                expect(sender.linkupId).toEqual(address2.linkupId);
                expect(sender.serverURL).toEqual(address2.serverURL);
                expect(recipient.linkupId).toEqual(address1.linkupId);
                expect(recipient.serverURL).toEqual(address1.serverURL);
                expect(rcvdCallId).toEqual(callId);
                expect(rcvdInstanceId).toBeDefined();
                expect(rcvdMessage).toEqual(message);
                if (int !== undefined) { clearInterval(int); }
                linkupManager1Host.linkup.shutdown();
                linkupManager2.shutdown();
                done();
            });
            
            int = window.setInterval(() => {
                linkupManager2.sendMessageOnCall(address2, address1, callId, message);
            }, 100);
    
            
    
        }, 40000);

        test('[LNK05] Call answering w/proxy', (done) => {
            let eventCallback1 = (ev: LinkupManagerEvent) =>  {
                linkupManager1.linkupManagerEventIngestFn(ev);
            }

            let linkupManager1Host = new LinkupManagerHost(eventCallback1);

            let commandForwardingFn1 = (cmd: LinkupManagerCommand) => {
                linkupManager1Host.execute(cmd);
            }

            let linkupManager1 = new LinkupManagerProxy(commandForwardingFn1);

            let eventCallback2 = (ev: LinkupManagerEvent) =>  {
                linkupManager2.linkupManagerEventIngestFn(ev);
            }

            let linkupManager2Host = new LinkupManagerHost(eventCallback2);

            let commandForwardingFn2 = (cmd: LinkupManagerCommand) => {
                linkupManager2Host.execute(cmd);
            }

            let linkupManager2 = new LinkupManagerProxy(commandForwardingFn2);
    
            const rnd = new RNGImpl().randomHexString(64);
    
            let address1 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressOne_B_' + rnd);
            let address2 = new LinkupAddress(LinkupManager.defaultLinkupServer, 'addressTwo_B_' + rnd);
    
            let callId =  'DUMMY_CALL_ID_TEST_B';
            let message = 'MESSAGE_' + rnd;
            let reply   = 'REPLY';
    
            // one is going to listen for a message in a new call
            // two is going to send a message in a new call DUMMY_CALL_ID_TEST_B
            // one is going to send a message back on call DUMMT_CALL_ID_TEST_B
    
            let int:any = undefined;
    
            linkupManager1.listenForMessagesNewCall(address1, (sender: LinkupAddress, recipient: LinkupAddress, rcvdCallId: string, rcvdInstanceId: string, rcvdMessage: any) => {
                expect(sender.linkupId).toEqual(address2.linkupId);
                expect(sender.serverURL).toEqual(address2.serverURL);
                expect(recipient.linkupId).toEqual(address1.linkupId);
                expect(recipient.serverURL).toEqual(address1.serverURL);
                expect(rcvdCallId).toEqual(callId);
                expect(rcvdInstanceId).toBeDefined();
                expect(rcvdMessage).toEqual(message);
                linkupManager1.sendMessageOnCall(address1, address2, callId, reply);
                
            });
    
            linkupManager2.listenForMessagesOnCall(address2, callId, (instanceId: string, message: string) => {

                expect(instanceId).toBeDefined();
                expect(message).toEqual(reply);
                if (int !== undefined) { clearInterval(int); }
                linkupManager1Host.linkup.shutdown();
                linkupManager2Host.linkup.shutdown();
                done();
            });
            
            int = window.setInterval(() => {
                linkupManager2.sendMessageOnCall(address2, address1, callId, message);
            }, 100);
    
            
    
        }, 40000);
});
Example #12
Source File: transport.test.ts    From hyperhyperspace-core with MIT License 4 votes vote down vote up
describeProxy('[TRA] Transports', () => {

    test('[TRA01] WebRTC send / answer', (done) => {
        let linkupManager1 = new LinkupManager();
        let linkupManager2 = new LinkupManager();

        //let linkupServer2 = LinkupManager.defaultLinkupServer;
        let linkupServer1 = LinkupManager.defaultLinkupServer;

        const rnd = new RNGImpl().randomHexString(64);

        let address1 = new LinkupAddress(linkupServer1, 'addressOne_C_' + rnd);
        let address2 = new LinkupAddress(linkupServer1, 'addressTwo_C_' + rnd);

        let theCallId = 'DUMMY_CALL_ID_TEST_C_' + rnd;
        let channelName = "test_data_channel";

        let conn2: WebRTCConnection|undefined = undefined;

        linkupManager2.listenForMessagesNewCall(address2, (sender: LinkupAddress, receiver: LinkupAddress, callId: string, instanceId: string, message: any) => {
            receiver;
            conn2 = new WebRTCConnection(linkupManager2, address2, sender, callId, (conn: Connection) => {
                expect(sender.linkupId).toEqual(address1.linkupId);
                expect(conn.getConnectionId()).toEqual(theCallId);
            });
            conn2.setMessageCallback((message: any, _conn: Connection) => {
                expect(message).toEqual("hola");
                conn2?.send("chau");
            });
            conn2.answer(instanceId, message);
        });

        let conn1 = new WebRTCConnection(linkupManager1, address1, address2, theCallId, (conn: Connection) => {
            conn.send("hola");
        });

        conn1.setMessageCallback((message: any) => {
            expect(message).toEqual("chau");
            conn1.close();
            conn2?.close();
            linkupManager1.shutdown();
            linkupManager2.shutdown();
            done();
        });

        conn1.open(channelName);
    }, 15000);

    test('[TRA02] WebSocket send / answer', (done) => {

        //let linkupManager1 = new LinkupManager();
        let linkupManager2 = new LinkupManager();

        //let linkupServer2 = LinkupManager.defaultLinkupServer;

        let listenAddress1 = 'ws://localhost:10000';
        let listenAddress2 = 'ws://localhost:10001';

        const rnd = new RNGImpl().randomHexString(64);

        let address1 = new LinkupAddress(listenAddress1, 'addressOne_D_' + rnd);
        let address2 = new LinkupAddress(listenAddress2, 'addressTwo_D_' + rnd);

        let theCallId = 'DUMMY_CALL_ID_TEST_D_' + rnd;

        let conn2: WebSocketConnection|undefined = undefined;

        linkupManager2.listenForMessagesNewCall(address2, (sender: LinkupAddress, receiver: LinkupAddress, callId: string, instanceId: string, message: any) => {
            receiver;

            instanceId;

            conn2 = new WebSocketConnection(callId, address2, sender, (conn: Connection) => {
                expect(sender.linkupId).toEqual(address1.linkupId);
                expect(conn.getConnectionId()).toEqual(theCallId);
            });

            conn2.setMessageCallback((message: any, _conn: Connection) => {
                expect(message).toEqual("hola");
                conn2?.send("chau");
            });

            conn2.answer(instanceId, message);
        });

        let conn1 = new WebSocketConnection(theCallId, address1, address2, (conn: Connection) => {
            conn.send("hola");
        });

        conn1.setMessageCallback((message: any) => {
            expect(message).toEqual("chau");
            conn1.close();
            conn2?.close();
            linkupManager2.shutdown();
            done();
        });

        setTimeout(() => { conn1.open(); }, 100);
        


    }, 15000);


    test('[TRA03] WebRTC -> WebSocket send / answer', (done) => {

        //let linkupManager1 = new LinkupManager();
        let linkupManager2 = new LinkupManager();

        //let linkupServer2 = LinkupManager.defaultLinkupServer;

        let listenAddress1 = LinkupManager.defaultLinkupServer;
        let listenAddress2 = 'ws://localhost:10011';

        const rnd = new RNGImpl().randomHexString(64);

        let address1 = new LinkupAddress(listenAddress1, 'addressOne_F_' + rnd);
        let address2 = new LinkupAddress(listenAddress2, 'addressTwo_F_' + rnd);

        let theCallId = 'DUMMY_CALL_ID_TEST_F_' + rnd;

        let conn2: WebSocketConnection|undefined = undefined;

        linkupManager2.listenForMessagesNewCall(address2, (sender: LinkupAddress, receiver: LinkupAddress, callId: string, instanceId: string, message: any) => {
            receiver;
            
            instanceId;

            conn2 = new WebSocketConnection(callId, address2, sender, (conn: Connection) => {
                expect(sender.linkupId).toEqual(address1.linkupId);
                expect(conn.getConnectionId()).toEqual(theCallId);
            });

            conn2.setMessageCallback((message: any, _conn: Connection) => {
                expect(message).toEqual("hola");
                conn2?.send("chau");
            });

            conn2.answer(instanceId, message);
        });

        let conn1 = new WebSocketConnection(theCallId, address1, address2, (conn: Connection) => {
            conn.send("hola");
        });

        conn1.setMessageCallback((message: any) => {
            expect(message).toEqual("chau");
            conn1.close();
            conn2?.close();
            linkupManager2.shutdown();
            done();
        });

        setTimeout(() => { conn1.open(); }, 100);
        


    }, 15000);


    test('[TRA04] WebSocket -> WebRTC send / answer w/reverse connection', (done) => {

        let linkupManager1 = new LinkupManager();
        let linkupManager2 = new LinkupManager();

        //let linkupServer2 = LinkupManager.defaultLinkupServer;

        let listenAddress1 = 'ws://localhost:10020';
        let listenAddress2 = LinkupManager.defaultLinkupServer;

        const rnd = new RNGImpl().randomHexString(64);

        let address1 = new LinkupAddress(listenAddress1, 'addressOne_E_' + rnd);
        let address2 = new LinkupAddress(listenAddress2, 'addressTwo_E_' + rnd);

        let theCallId = 'DUMMY_CALL_ID_TEST_E_' + rnd;

        let conn2: WebSocketConnection|undefined = undefined;

        linkupManager2.listenForMessagesNewCall(address2, (sender: LinkupAddress, receiver: LinkupAddress, callId: string, instanceId: string, message: any) => {
            receiver;

            instanceId;

            conn2 = new WebSocketConnection(callId, address2, sender, (conn: Connection) => {
                expect(sender.linkupId).toEqual(address1.linkupId);
                expect(conn.getConnectionId()).toEqual(theCallId);
                expect(conn.initiatedLocally()).toBeFalsy();
            });

            conn2.setMessageCallback((message: any, _conn: Connection) => {
                expect(message).toEqual("hola");
                conn2?.send("chau");
            });

            conn2.answer(instanceId, message);
        });

        let conns:any = {};

        linkupManager1.listenForMessagesNewCall(address1, (sender: LinkupAddress, receiver: LinkupAddress, callId: string, instanceId: string, message: any) => {
            
            sender; receiver;

            instanceId;

            if (callId === theCallId) {
                let c = conns[callId];
                c.answer(instanceId, message);
            }
            
        });

        let conn1 = new WebSocketConnection(theCallId, address1, address2, (conn: Connection) => {
            conn.send("hola");
        }, linkupManager1);

        conns[theCallId] = conn1;

        conn1.setMessageCallback((message: any) => {
            expect(message).toEqual("chau");
            expect(conn1.initiatedLocally()).toBeTruthy();
            conn1.close();
            conn2?.close();
            linkupManager1.shutdown();
            linkupManager2.shutdown();
            done();
        });

        setTimeout(() => { conn1.open(); }, 100);
        


    }, 15000);

    test('[TRA05] WebRTC send / answer w/proxies', (done) => {

            let eventCallback = (ev: LinkupManagerEvent) =>  {
                linkupManager1.linkupManagerEventIngestFn(ev);
            }

            let linkupManager1Host = new LinkupManagerHost(eventCallback);

            let commandForwardingFn = (cmd: LinkupManagerCommand) => {
                linkupManager1Host.execute(cmd);
            }

        let linkupManager1 = new LinkupManagerProxy(commandForwardingFn);
        let eventCallback2 = (ev: LinkupManagerEvent) =>  {
            linkupManager2.linkupManagerEventIngestFn(ev);
        }

        let linkupManager2Host = new LinkupManagerHost(eventCallback2);

        let commandForwardingFn2 = (cmd: LinkupManagerCommand) => {
            linkupManager2Host.execute(cmd);
        }

        let linkupManager2 = new LinkupManagerProxy(commandForwardingFn2);

        //let linkupServer2 = LinkupManager.defaultLinkupServer;
        let linkupServer1 = LinkupManager.defaultLinkupServer;

        const rnd = new RNGImpl().randomHexString(64);

        let address1 = new LinkupAddress(linkupServer1, 'addressOne_F_' + rnd);
        let address2 = new LinkupAddress(linkupServer1, 'addressTwo_F_' + rnd);

        let theCallId = 'DUMMY_CALL_ID_TEST_F_' + rnd;
        let channelName = "test_data_channel";

        let conn2: WebRTCConnection|undefined = undefined;

        linkupManager2.listenForMessagesNewCall(address2, (sender: LinkupAddress, receiver: LinkupAddress, callId: string, instanceId: string, message: any) => {
            receiver;

            let webRTCEventCallback2 = (ev: WebRTCConnectionEvent) => {
                conn2.connectionEventIngestFn(ev);
            }

            let connHost2 = new WebRTCConnectionsHost(webRTCEventCallback2, linkupManager2 as any as LinkupManager);

            let webRTCcommandForwardingFn2 = (cmd: WebRTCConnectionCommand) => {
                connHost2.execute(cmd);
            }
    
            let conn2 = new WebRTCConnectionProxy(address2, sender, callId, (conn: Connection) => {
                expect(sender.linkupId).toEqual(address1.linkupId);
                expect(conn.getConnectionId()).toEqual(theCallId);
            }, webRTCcommandForwardingFn2)



            /*conn2 = new WebRTCConnection(linkupManager2, address2, sender, callId, (conn: Connection) => {
                expect(sender.linkupId).toEqual(address1.linkupId);
                expect(conn.getConnectionId()).toEqual(theCallId);
            });*/
            conn2.setMessageCallback((message: any, _conn: Connection) => {
                expect(message).toEqual("hola");
                conn2?.send("chau");
            });
            conn2.answer(instanceId, message);
        });

        let webRTCEventCallback1 = (ev: WebRTCConnectionEvent) => {
            conn1.connectionEventIngestFn(ev);
        }

        let connHost1 = new WebRTCConnectionsHost(webRTCEventCallback1, linkupManager1 as any as LinkupManager);


        let webRTCcommandForwardingFn1 = (cmd: WebRTCConnectionCommand) => {
            connHost1.execute(cmd);
        }

        let conn1 = new WebRTCConnectionProxy(address1, address2, theCallId, (conn: Connection) => {
            conn.send("hola");
        }, webRTCcommandForwardingFn1)

        
        /*let _conn1 = new WebRTCConnection(linkupManager1 as any as LinkupManager, address1, address2, theCallId, (conn: Connection) => {
            conn.send("hola");
        });*/

        conn1.setMessageCallback((message: any) => {
            expect(message).toEqual("chau");
            conn1.close();
            conn2?.close();
            linkupManager1Host.linkup.shutdown();
            linkupManager2Host.linkup.shutdown();
            done();
        });

        conn1.open(channelName);
    }, 15000);

});
Example #13
Source File: store.test.ts    From hyperhyperspace-core with MIT License 4 votes vote down vote up
//import { SQLiteBackend } from '@hyper-hyper-space/sqlite';


describeProxy('[STR] Storage', () => {
    test('[STR01] Indexeddb-based load / store cycle', async () => {
        let store = new Store(new IdbBackend('test-storage-backend'));
        await testLoadStoreCycle(store);
        store.close();
    });

    test('[STR02] Memory-based load / store cycle', async() => {
        let store = new Store(new MemoryBackend('test-storage-backend'));
        await testLoadStoreCycle(store);
        store.close();
    });

    /*test('[STR03] SQLite-based load / store cycle', async() => {
        let store = new Store(new SQLiteBackend(':memory:'));
        await testLoadStoreCycle(store);
        store.close();
    });*/

    test('[STR04] Indexeddb-based reference-based load hit', async () => {
        let store = new Store(new IdbBackend('test-storage-backend'));
        await testReferenceBasedLoadHit(store);
        store.close();
    });

    test('[STR05] Memory-based reference-based load hit', async () => {
        let store = new Store(new MemoryBackend('test-storage-backend'));
        await testReferenceBasedLoadHit(store);
        store.close();
    });

    /*test('[STR06] SQLite-based reference-based load hit', async () => {
        let store = new Store(new SQLiteBackend(':memory:'));
        await testReferenceBasedLoadHit(store);
        store.close();
    });*/

    test('[STR07] Indexeddb-based reference-based load miss', async () => {
        let store = new Store(new IdbBackend('test-storage-backend'));
        await testReferenceBasedLoadMiss(store);
        store.close();
    });

    test('[STR08] Memory-based reference-based load miss', async () => {
        let store = new Store(new MemoryBackend('test-storage-backend'));
        await testReferenceBasedLoadMiss(store);
        store.close();
    });

    /*test('[STR09] SQLite-based reference-based load miss', async () => {
        let store = new Store(new SQLiteBackend(':memory:'));
        await testReferenceBasedLoadMiss(store);
        store.close();
    });*/
    
    test('[STR07] Indexeddb-based mutation op saving and loading', async () => {
        let store = new Store(new IdbBackend('test-storage-backend'));
        await testMutationOps(store);
        store.close();
    });

    test('[STR08] Memory-based mutation op saving and loading', async () => {
        let store = new Store(new MemoryBackend('test-storage-backend'));
        await testMutationOps(store);
        store.close();
    });

    /*test('[STR09] SQLite-based mutation op saving and loading', async () => {
        let store = new Store(new SQLiteBackend(':memory:'));
        await testMutationOps(store);
        store.close();
    });*/

    test('[STR10] Indexeddb-based mutation op saving and auto-loading', async () => {
        let store = new Store(new IdbBackend('test-storage-backend'));
        await testMutationOpAutoLoad(store);
        store.close();
    });

    test('[STR11] Memory-based mutation op saving and auto-loading', async () => {
        let store = new Store(new MemoryBackend('test-storage-backend'));
        await testMutationOpAutoLoad(store);
        store.close();
    });

    /*test('[STR12] SQLite-based mutation op saving and auto-loading', async () => {
        let store = new Store(new SQLiteBackend(':memory:'));
        await testMutationOpAutoLoad(store);
        store.close();
    });*/

    test('[STR13] Indexeddb-based mutation op automatic prevOp generation', async () => {
        let store = new Store(new IdbBackend('test-storage-backend'));
        await testPrevOpGeneration(store);
        store.close();
    });

    test('[STR14] Memory-based mutation op automatic prevOp generation', async () => {
        let store = new Store(new MemoryBackend('test-storage-backend'));
        await testPrevOpGeneration(store);
        store.close();
    });

    /*test('[STR15] SQLite-based mutation op automatic prevOp generation', async () => {
        let store = new Store(new SQLiteBackend(':memory:'));
        await testPrevOpGeneration(store);
        store.close();
    });*/

    test('[STR16] Validate history retrieved from IDB store', async () => {
        let store = new Store(new IdbBackend('test-storage-backend'));
        await testHistoryGeneration(store);
        store.close();
    });

    test('[STR17] Validate history retrieved from memory store', async () => {
        let store = new Store(new MemoryBackend('test-storage-backend'));
        await testHistoryGeneration(store);
        store.close();
    });

    /*test('[STR18] Validate history retrieved from SQLite store', async () => {
        let store = new Store(new SQLiteBackend(':memory:'));
        await testHistoryGeneration(store);
        store.close();
    });*/

});
Example #14
Source File: undo.test.ts    From hyperhyperspace-core with MIT License 4 votes vote down vote up
describeProxy('[UND] Undo support', () => {
    test( '[UND01] Basic undo w/ IndexedDB backend', async (done) => {

        let store = new Store(new IdbBackend('test-basic-undo'));
        
        await testBasicUndoCycle(store);

        //store.close();

        done();
    }, 30000);

    test( '[UND02] Basic undo w/ memory backend', async (done) => {

        let store = new Store(new MemoryBackend('test-basic-undo'));
        
        await testBasicUndoCycle(store);

        //store.close();

        done();
    }, 30000);

    test( '[UND03] Basic undo w/ IndexedDB backend over sync', async (done) => {

        let stores = [new Store(new IdbBackend('test-basic-undo-over-sync-1')),
                      new Store(new IdbBackend('test-basic-undo-over-sync-2'))];
        
        await testBasicUndoCycleWithSync(stores);

        /*for (const store of stores) {
            store.close();
        }*/

        done();
    }, 50000);

    test( '[UND04] Basic undo w/ memory backend over sync', async (done) => {

        let stores = [new Store(new MemoryBackend('test-basic-undo-over-sync-1')),
                      new Store(new MemoryBackend('test-basic-undo-over-sync-2'))];
        
        await testBasicUndoCycleWithSync(stores);

        /*for (const store of stores) {
            store.close();
        }*/

        done();
    }, 50000);

    test( '[UND05] Multi object undo cascade w/ IndexedDB backend', async (done) => {

        let store = new Store(new IdbBackend('test-basic-undo'));
        
        await testMultiObjectUndoCascade(store);

        //store.close();

        done();
    }, 30000);

    test( '[UND06] Multi object undo cascade  w/ memory backend', async (done) => {

        let store = new Store(new MemoryBackend('test-basic-undo'));
        
        //await testMultiObjectUndoCascade(store);

        store.close();

        done();
    }, 30000);

    test( '[UND07] Multi object undo cascade w/ IndexedDB backend over sync', async (done) => {

        let stores = [new Store(new IdbBackend('test-basic-undo-over-sync-1')),
                      new Store(new IdbBackend('test-basic-undo-over-sync-2'))];
        
        await testMultiObjectUndoCascadeWithSync(stores);

        /*for (const store of stores) {
            store.close();
        }*/

        done();
    }, 50000);

    test( '[UND08] Multi object undo cascade w/ memory backend over sync', async (done) => {

        let stores = [new Store(new MemoryBackend('test-basic-undo-over-sync-1')),
                      new Store(new MemoryBackend('test-basic-undo-over-sync-2'))];
        
        await testMultiObjectUndoCascadeWithSync(stores);

        /*for (const store of stores) {
            store.close();
        }*/

        done();
    }, 100000);

    test( '[UND09] CausalSet undo cascade w/ IndexedDB backend over sync', async (done) => {

        let stores = [new Store(new IdbBackend('causal-set-undo-over-sync-1')),
                      new Store(new IdbBackend('causal-set-undo-over-sync-2'))];
        
        await testMultiObjectUndoCascadeWithSyncUsingCausalSets(stores);

        /*for (const store of stores) {
            store.close();
        }*/

        done();
    }, 100000);

    test( '[UND10] CausalSet undo cascade w/ memory backend over sync', async (done) => {

        let stores = [new Store(new MemoryBackend('causal-set-undo-over-sync-1')),
                      new Store(new MemoryBackend('causal-set-undo-over-sync-2'))];
        
        await testMultiObjectUndoCascadeWithSyncUsingCausalSets(stores);

        /*for (const store of stores) {
            store.close();
        }*/

        done();
    }, 100000);
});