Skip to content

Commit

Permalink
get coverage back
Browse files Browse the repository at this point in the history
  • Loading branch information
RB-Lab committed Nov 29, 2021
1 parent 224b1e1 commit 1a83503
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 0 additions & 1 deletion src/telegramServer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,6 @@ export class TelegramServer extends EventEmitter {

async addUserCommand(message: CommandRequest) {
assert.ok(message.entities, 'Command should have entities');

await this.addUserUpdate({
...this.getCommonFields(message.botToken),
message,
Expand Down
9 changes: 9 additions & 0 deletions src/test/generic.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,15 @@ describe('Telegram Server', () => {
}).catch((err) => assert.fail(err));
});

it('waits user message', async () => {
const { server, client } = await getServerAndClient(token);
client.sendCommand(client.makeCommand('/start'));
await server.waitUserMessage();
const history = await client.getUpdatesHistory();
assert.equal(history.length, 1);
await server.stop();
});

it('should fully implement user-bot interaction', async () => {
const { server, client } = await getServerAndClient(token);
let message = client.makeMessage('/start');
Expand Down

0 comments on commit 1a83503

Please sign in to comment.