Skip to content

Commit

Permalink
refactor(xo): update and adapt to new lints
Browse files Browse the repository at this point in the history
  • Loading branch information
EdJoPaTo committed Apr 11, 2023
1 parent b9c8fdc commit b16f9d9
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 13 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"grammy": "^1.10.1",
"nyc": "^15.0.0",
"typescript": "^5.0.2",
"xo": "^0.53.0"
"xo": "^0.54.0"
},
"files": [
"dist/source",
Expand Down
1 change: 0 additions & 1 deletion source/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import {type Context as BaseContext} from 'grammy';

import {
getAdditionalState,
isContextReplyToMessage,
Expand Down
28 changes: 17 additions & 11 deletions test/test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import test from 'ava';
import {Bot} from 'grammy';

import {
suffixHTML,
suffixMarkdown,
Expand Down Expand Up @@ -109,7 +108,7 @@ test('can replyWithMarkdown the question correctly', async t => {
bot.use(async ctx => question.replyWithMarkdown(ctx, 'banana'));
await bot.handleUpdate({
update_id: 42,
} as any);
});
});

test('can replyWithMarkdownV2 the question correctly', async t => {
Expand Down Expand Up @@ -142,7 +141,7 @@ test('can replyWithMarkdownV2 the question correctly', async t => {
bot.use(async ctx => question.replyWithMarkdownV2(ctx, 'banana'));
await bot.handleUpdate({
update_id: 42,
} as any);
});
});

test('can replyWithHTML the question correctly', async t => {
Expand Down Expand Up @@ -175,7 +174,7 @@ test('can replyWithHTML the question correctly', async t => {
bot.use(async ctx => question.replyWithHTML(ctx, 'banana'));
await bot.handleUpdate({
update_id: 42,
} as any);
});
});

test('ignores different update', async t => {
Expand Down Expand Up @@ -242,13 +241,14 @@ test('ignores message replying to something else', async t => {
chat: {id: 42, type: 'private', first_name: 'Bob'},
date: 42,
text: 'unrelated',
// @ts-expect-error missing some keys
reply_to_message: {
message_id: 43,
from: {id: 42, first_name: 'Bob', is_bot: true},
chat: {id: 42, type: 'private', first_name: 'Bob'},
date: 10,
text: 'whatever',
} as any,
},
},
});
});
Expand All @@ -272,6 +272,7 @@ test('ignores message replying to something else with entities', async t => {
chat: {id: 42, type: 'private', first_name: 'Bob'},
date: 42,
text: 'unrelated',
// @ts-expect-error missing some keys
reply_to_message: {
message_id: 43,
from: {id: 42, first_name: 'Bob', is_bot: true},
Expand All @@ -284,7 +285,7 @@ test('ignores message replying to something else with entities', async t => {
offset: 0,
length: 2,
}],
} as any,
},
},
});
});
Expand All @@ -308,6 +309,7 @@ test('ignores message replying to another question', async t => {
chat: {id: 42, type: 'private', first_name: 'Bob'},
date: 42,
text: 'unrelated',
// @ts-expect-error missing some keys
reply_to_message: {
message_id: 43,
from: {id: 42, first_name: 'Bob', is_bot: true},
Expand All @@ -320,7 +322,7 @@ test('ignores message replying to another question', async t => {
offset: 0,
length: 2,
}],
} as any,
},
},
});
});
Expand All @@ -345,6 +347,7 @@ test('correctly works with text message', async t => {
chat: {id: 42, type: 'private', first_name: 'Bob'},
date: 42,
text: 'the answer',
// @ts-expect-error missing some keys
reply_to_message: {
message_id: 43,
from: {id: 42, first_name: 'Bob', is_bot: true},
Expand All @@ -357,7 +360,7 @@ test('correctly works with text message', async t => {
offset: 0,
length: 2,
}],
} as any,
},
},
});
});
Expand All @@ -383,6 +386,7 @@ test('correctly works with text message with additional state', async t => {
chat: {id: 42, type: 'private', first_name: 'Bob'},
date: 42,
text: 'the answer',
// @ts-expect-error missing some keys
reply_to_message: {
message_id: 43,
from: {id: 42, first_name: 'Bob', is_bot: true},
Expand All @@ -395,7 +399,7 @@ test('correctly works with text message with additional state', async t => {
offset: 0,
length: 2,
}],
} as any,
},
},
});
});
Expand All @@ -421,6 +425,7 @@ test('additional state url encoding is removed before passed to function', async
chat: {id: 42, type: 'private', first_name: 'Bob'},
date: 42,
text: 'the answer',
// @ts-expect-error missing some keys
reply_to_message: {
message_id: 43,
from: {id: 42, first_name: 'Bob', is_bot: true},
Expand All @@ -433,7 +438,7 @@ test('additional state url encoding is removed before passed to function', async
offset: 0,
length: 2,
}],
} as any,
},
},
});
});
Expand All @@ -458,6 +463,7 @@ test('correctly works with media message', async t => {
chat: {id: 42, type: 'private', first_name: 'Bob'},
date: 42,
text: 'the answer',
// @ts-expect-error missing some keys
reply_to_message: {
message_id: 43,
from: {id: 42, first_name: 'Bob', is_bot: true},
Expand All @@ -471,7 +477,7 @@ test('correctly works with media message', async t => {
offset: 0,
length: 2,
}],
} as any,
},
},
});
});

0 comments on commit b16f9d9

Please sign in to comment.