Skip to content

Commit

Permalink
added .log file test
Browse files Browse the repository at this point in the history
  • Loading branch information
smitshah2531 committed Jul 21, 2020
1 parent 4e74df6 commit 452891f
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion packages/apex-node/test/logs/logService.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,4 +171,21 @@ describe('Apex Log Service Tests', () => {
expect(existsStub.callCount).to.eql(2);
expect(mkdirStub.callCount).to.eql(1);
});
});

it('should successfully create a .log file', async () => {
const apexLogGet = new LogService(mockConnection);
const filePath = path.join('Users', 'smit.shah', 'Desktop', 'mod');
const logIds = ['07WgsWfad', '9SiomgS'];
const logs = ['48jnskd', '57fskjf'];
const logsPath = path.join(filePath, `${logIds[0]}.log`)
const createStreamStub = sandboxStub.stub(fs, 'createWriteStream').returns({
//@ts-ignore
write: () => {},
end: () => {}
});
toolingRequestStub.onFirstCall().resolves(logs[0]);
toolingRequestStub.onSecondCall().resolves(logs[1]);
await apexLogGet.writeLog(filePath,logs[0],logIds[0]);
expect(createStreamStub.calledWith(logsPath)).to.be.ok;
});
});

0 comments on commit 452891f

Please sign in to comment.