add test of logs when linkign new device without anything

pull/1137/head
Audric Ackermann 5 years ago
parent 13791d28be
commit 9d2ddadf1b
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -630,6 +630,19 @@ module.exports = {
}
},
/**
* Search for a string in logs
* @param {*} app the render logs to search in
* @param {*} str the string to search (not regex)
* Note: getRenderProcessLogs() clears the app logs each calls.
*/
async logsContains(renderLogs, str) {
const found = renderLogs.some(log => log.message.includes(str));
// eslint-disable-next-line no-unused-expressions
chai.expect(found, `'${str}' not found in logs but was expected`).to.be.true;
},
// async killStubSnodeServer() {
// return new Promise(resolve => {
// exec(

@ -45,4 +45,23 @@ describe('Link Device', function() {
await common.timeout(1000);
await common.triggerUnlinkApp2FromApp(app, app2);
});
describe('linkDevice:sync no groups, closed group, nor open groups', async () => {
await common.linkApp2ToApp(app, app2, common.TEST_PUBKEY1);
await common.timeout(2000);
// get logs at this stage (getRenderProcessLogs() clears the app logs)
const secondaryRenderLogs = await app2.client.getRenderProcessLogs();
// pairing request message sent from secondary to primary pubkey
await common.logsContains(secondaryRenderLogs, `Sending pairing-request:pairing-request message to ${common.TEST_PUBKEY1}`);
const primaryRenderLogs = await app.client.getRenderProcessLogs();
// primary grant pairing request
await common.logsContains(primaryRenderLogs, 'Sending pairing-request:pairing-request message to OUR SECONDARY PUBKEY');
// no friends, no closed groups, no open groups. we should see those message sync in the log
await common.logsContains(primaryRenderLogs, 'No closed group to sync.');
await common.logsContains(primaryRenderLogs, 'No open groups to sync');
await common.logsContains(primaryRenderLogs, 'No contacts to sync.');
});
});

Loading…
Cancel
Save