fix: filter and cw logic (#1633)
This commit is contained in:
parent
a1b2da3d5e
commit
0fbe34c1e8
4 changed files with 42 additions and 16 deletions
|
@ -1,28 +1,49 @@
|
|||
/** @vitest-environment happy-dom */
|
||||
|
||||
import type { mastodon } from 'masto'
|
||||
import { describe, expect, it } from 'vitest'
|
||||
|
||||
function status(id: string, filtered?: mastodon.v1.FilterContext): mastodon.v1.Status {
|
||||
const fakeStatus = {
|
||||
id,
|
||||
account: {
|
||||
id: 'FAKE ID',
|
||||
} as mastodon.v1.Account,
|
||||
} as mastodon.v1.Status
|
||||
|
||||
if (filtered) {
|
||||
return {
|
||||
id,
|
||||
filtered: [
|
||||
fakeStatus.filtered
|
||||
= [
|
||||
{
|
||||
filter: {
|
||||
filterAction: 'hide',
|
||||
context: [filtered],
|
||||
},
|
||||
} as mastodon.v1.FilterResult,
|
||||
],
|
||||
} as mastodon.v1.Status
|
||||
]
|
||||
}
|
||||
|
||||
return { id } as mastodon.v1.Status
|
||||
return fakeStatus
|
||||
}
|
||||
|
||||
function reply(id: string, s: mastodon.v1.Status) {
|
||||
return { id, inReplyToId: s.id } as mastodon.v1.Status
|
||||
return {
|
||||
id,
|
||||
account: {
|
||||
id: 'FAKE ID',
|
||||
} as mastodon.v1.Account,
|
||||
inReplyToId: s.id,
|
||||
} as mastodon.v1.Status
|
||||
}
|
||||
|
||||
function reblog(id: string, s: mastodon.v1.Status) {
|
||||
return { id, reblog: s } as mastodon.v1.Status
|
||||
return {
|
||||
id,
|
||||
account: {
|
||||
id: 'FAKE ID',
|
||||
} as mastodon.v1.Account,
|
||||
reblog: s,
|
||||
} as mastodon.v1.Status
|
||||
}
|
||||
|
||||
const p_a1 = status('p_a1')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue