( () => { return connect( null, { stopPerformanceTracking: ( metadata = {} ) => ( dispatch, getState ) => { const state = getState(); const sectionName = getSectionName( state ); stopPerformanceTracking( sectionName, { state, metadata } ); }, } ); } )()
describe('Insert one', () => { test('It should calculate id for the item', async () => { const database = new Database(); await database.connect(); const collection = database.getCollection('items'); const inserted = await collection.insertOne({ num: 7 }); expect(inserted).toBeDefined(); expect(inserted.id).toBeDefined(); expect(inserted.num).toEqual(7); }); });
/** * @description Prepares service and starts connection with broker. * @example * init(); */ async function init() { DEFAULT.TOPICS.forEach((topic) => { this.subscribe(topic, this.handleGladysMessage.bind(this)); }); const configuration = await this.getConfiguration(); await this.connect(configuration); }
amqp.connect(URI) .then((connection) => { const donePromise = destroy ? Promise.all( queues.map(deleteQueue(connection)).concat(exchanges.map(deleteExchange(connection))) ) : Promise.all(queues.map(clearQueue(connection))); return donePromise .then(() => connection.close()) .catch(() => {}); })
beforeEach(() => { if (transporter) transporter.disconnect(); broker = new ServiceBroker({ logger: false, namespace: "TEST", nodeID: "node", internalServices: false }); msgHandler = jest.fn(); transporter = new Amqp10Transporter({ url: "amqp10://localhost" }); transporter.init(new Transit(broker), msgHandler); transporter.incomingMessage = jest.fn(); return transporter.connect(); });
it("check onConnected after connect", () => { transporter.onConnected = jest.fn(() => Promise.resolve()); let p = transporter.connect().catch(protectReject).then(() => { expect(transporter.onConnected).toHaveBeenCalledTimes(1); expect(transporter.onConnected).toHaveBeenCalledWith(); }); transporter._client.callbacks.connect(); // Trigger the `resolve` return p; });
function() { var multiplex = Reveal.getConfig().multiplex; var socketId = multiplex.id; var socket = io.connect(multiplex.url); socket.on(multiplex.id, function(data) { // ignore data from sockets that aren't ours if (data.socketId !== socketId) { return; } if( window.location.host === 'localhost:1947' ) return; Reveal.slide(data.indexh, data.indexv, data.indexf, 'remote'); }); }()
connect( ( state ) => { const siteId = getSelectedSiteId( state ); const siteSlug = getSiteSlug( state, siteId ); return { status: getStatus( state, siteId ), siteId, siteSlug, }; } )
describe('Update', () => { test('It throws an exception if the id does not exists', async () => { const adapter = new MemorydbAdapter(); await adapter.connect(); await expect(adapter.update('items', { id: 'a' })).rejects.toThrow( 'Trying to update collection items with a non existing item with id a' ); }); });
this.producer.connect(options, function(err, data) { if (err) { this.emit('error', err); return; } }.bind(this));
connect( ( state, { siteId } ) => { return { requestingPlugins: isRequestingPlugins( state, siteId ), }; }, { requestPlugins } )( QueryPlugins )
describe('Connect', () => { test('Should initialize the collections', async () => { const adapter = new MemorydbAdapter(); adapter.collections = { something: 1 }; await adapter.connect(); expect(adapter.collections).toEqual({}); }); });
connect( ( state, { siteId } ) => { return { requestingSettings: isRequestingSettings( state, siteId ), }; }, { requestSettings } )( QuerySettings )
connect( ( state ) => ( { siteId: getSelectedSiteId( state ), siteSlug: getSelectedSiteSlug( state ), } ), { addZone } )
connect( ( state ) => { const siteId = getSelectedSiteId( state ); return { isDeleting: isDeletingFile( state, siteId ), siteId, }; }, { deleteFile } )