Skip to content

Commit

Permalink
chore: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
leaftail1880 committed Sep 2, 2024
1 parent a64538d commit 1f49d44
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/lib/form/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export declare namespace ArrayForm {
back: VoidFunction,
) => [text: string, callback: NewFormCallback] | false
type Sort<T, F> = (array: T[], filters: F) => T[]
type AddCustomButtons<TH> = (this: TH, form: ActionForm) => void
type AddCustomButtons<TH> = (this: TH, form: ActionForm, back: VoidFunction) => void

interface Options<T, C extends SettingsConfig, F extends SettingsConfigParsed<C> = SettingsConfigParsed<C>> {
filters: C
Expand Down Expand Up @@ -117,7 +117,7 @@ export class ArrayForm<
this.addSearchButton(form, searchQuery, player, fromPage, filtersDatabase, filters)
}

this.config.addCustomButtonBeforeArray?.(form)
this.config.addCustomButtonBeforeArray?.(form, selfback)

// Array item buttons & navigation
if (paginator.canGoBack)
Expand Down
2 changes: 1 addition & 1 deletion src/lib/text.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ describe('text', () => {
expect(
t.error`Много текста ${'длинной'} и полезной в ${5} степени ошибки, произведенной игроком ${player}`,
).toMatchInlineSnapshot(
`"§cМного текста §fдлинной§c и полезной в §65§c степени ошибки, произведенной игроком §fTest player name§c"`,
`"§cМного текста §fдлинной§c и полезной в §75§c степени ошибки, произведенной игроком §fTest player name§c"`,
)
})

Expand Down
2 changes: 1 addition & 1 deletion src/modules/commands/leaderboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ new Command('leaderboard')
function leaderboardMenu(player: Player) {
const form = new ActionForm('Таблицы лидеров')

form.addButton('§3Добавить', BUTTON['+'], editLeaderboard)
form.addButton('§3Добавить', BUTTON['+'], p => editLeaderboard(p))

for (const lb of Leaderboard.all.values()) {
form.addButton(info(lb), () => {
Expand Down
6 changes: 3 additions & 3 deletions src/modules/commands/role.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,14 @@ function roleMenu(player: Player) {
.filter(key => key[0] !== player.id)
} else return keys
})
.addCustomButtonBeforeArray(function (this, form) {
const button = this.button?.([player.id, player.database], { sort: 'role' }, form)
.addCustomButtonBeforeArray(function (this, form, back) {
const button = this.button?.([player.id, player.database], { sort: 'role' }, form, back)

if (button) form.addButton('§3Сменить мою роль\n§7(Восстановить потом: §f.role restore§7)', button[1])
})
.button(([id, { role, name: dbname }], _, form) => {
const target = players.find(e => e.id === id) ?? id
const name = typeof target === 'string' ? dbname ?? 'Без имени' : target.name
const name = typeof target === 'string' ? (dbname ?? 'Без имени') : target.name

return [
`${name}§r§f - ${ROLES[role]} ${typeof target === 'string' ? '§c(offline)' : ''}${
Expand Down

0 comments on commit 1f49d44

Please sign in to comment.