biome format --write

This commit is contained in:
Henry Jameson 2026-01-06 16:22:52 +02:00
commit 9262e803ec
415 changed files with 54076 additions and 17419 deletions

File diff suppressed because it is too large Load diff

View file

@ -17,8 +17,8 @@ export const injectMswToTest = (defaultHandlers) => {
worker.stop()
},
{
auto: true
}
auto: true,
},
],
})
}
@ -29,34 +29,44 @@ export const authApis = [
http.post(`${testServer}/api/v1/apps`, () => {
return HttpResponse.json({
client_id: 'test-id',
client_secret: 'test-secret'
client_secret: 'test-secret',
})
}),
http.get(`${testServer}/api/v1/apps/verify_credentials`, ({ request }) => {
const authHeader = request.headers.get('Authorization')
if (authHeader === 'Bearer test-app-token' ||
authHeader === 'Bearer also-good-app-token') {
if (
authHeader === 'Bearer test-app-token' ||
authHeader === 'Bearer also-good-app-token'
) {
return HttpResponse.json({})
} else {
// Pleroma 2.9.0 gives the following respoonse upon error
return HttpResponse.json({ error: { detail: 'Internal server error' } }, {
status: 400
})
return HttpResponse.json(
{ error: { detail: 'Internal server error' } },
{
status: 400,
},
)
}
}),
http.post(`${testServer}/oauth/token`, async ({ request }) => {
const data = await request.formData()
if (data.get('client_id') === 'test-id' &&
data.get('client_secret') === 'test-secret' &&
data.get('grant_type') === 'client_credentials' &&
data.has('redirect_uri')) {
if (
data.get('client_id') === 'test-id' &&
data.get('client_secret') === 'test-secret' &&
data.get('grant_type') === 'client_credentials' &&
data.has('redirect_uri')
) {
return HttpResponse.json({ access_token: 'test-app-token' })
} else {
// Pleroma 2.9.0 gives the following respoonse upon error
return HttpResponse.json({ error: 'Invalid credentials' }, {
status: 400
})
return HttpResponse.json(
{ error: 'Invalid credentials' },
{
status: 400,
},
)
}
})
}),
]

View file

@ -2,7 +2,7 @@ import { createStore } from 'vuex'
import { cloneDeep } from 'lodash'
import vuexModules from 'src/modules/index.js'
const tweakModules = modules => {
const tweakModules = (modules) => {
const res = {}
Object.entries(modules).forEach(([name, module]) => {
const m = { ...module }

View file

@ -4,8 +4,8 @@ import VueVirtualScroller from 'vue-virtual-scroller'
import routes from 'src/boot/routes'
import makeMockStore from './mock_store'
export const $t = msg => msg
const $i18n = { t: msg => msg }
export const $t = (msg) => msg
const $i18n = { t: (msg) => msg }
const applyAfterStore = (store, afterStore) => {
afterStore(store)
@ -19,17 +19,20 @@ const getDefaultOpts = ({ afterStore = () => {} } = {}) => ({
VueVirtualScroller,
createRouter({
history: createMemoryHistory(),
routes: routes({ state: {
users: {
currentUser: {}
routes: routes({
state: {
users: {
currentUser: {},
},
instance: {},
},
instance: {}
}})
}),
}),
(Vue) => { Vue.directive('body-scroll-lock', {}) }
(Vue) => {
Vue.directive('body-scroll-lock', {})
},
],
components: {
},
components: {},
stubs: {
I18nT: true,
teleport: true,
@ -38,23 +41,23 @@ const getDefaultOpts = ({ afterStore = () => {} } = {}) => ({
},
mocks: {
$t,
$i18n
}
}
$i18n,
},
},
})
// https://github.com/vuejs/vue-test-utils/issues/960
const customBehaviors = () => {
const filterByText = keyword => {
const match = keyword instanceof RegExp
? (target) => target && keyword.test(target)
: (target) => keyword === target
const filterByText = (keyword) => {
const match =
keyword instanceof RegExp
? (target) => target && keyword.test(target)
: (target) => keyword === target
return wrapper => (
return (wrapper) =>
match(wrapper.text()) ||
match(wrapper.attributes('aria-label')) ||
match(wrapper.attributes('title'))
)
match(wrapper.attributes('aria-label')) ||
match(wrapper.attributes('title'))
}
return {
@ -64,12 +67,10 @@ const customBehaviors = () => {
.at(0)
},
findByText(searchedElement, text) {
return this.findAll(searchedElement)
.filter(filterByText(text))
.at(0)
return this.findAll(searchedElement).filter(filterByText(text)).at(0)
},
};
};
}
}
config.plugins.VueWrapper.install(customBehaviors)
@ -79,12 +80,14 @@ export const mountOpts = (allOpts = {}) => {
const mergedOpts = {
...opts,
global: {
...defaultOpts.global
}
...defaultOpts.global,
},
}
if (opts.global) {
mergedOpts.global.plugins = mergedOpts.global.plugins.concat(opts.global.plugins || [])
mergedOpts.global.plugins = mergedOpts.global.plugins.concat(
opts.global.plugins || [],
)
Object.entries(opts.global).forEach(([k, v]) => {
if (k === 'plugins') {
return
@ -104,10 +107,11 @@ export const mountOpts = (allOpts = {}) => {
}
// https://stackoverflow.com/questions/78033718/how-can-i-wait-for-an-emitted-event-of-a-mounted-component-in-vue-test-utils
export const waitForEvent = (wrapper, event, {
timeout = 1000,
timesEmitted = 1
} = {}) => {
export const waitForEvent = (
wrapper,
event,
{ timeout = 1000, timesEmitted = 1 } = {},
) => {
const tick = 10
return vi.waitFor(
@ -120,7 +124,7 @@ export const waitForEvent = (wrapper, event, {
},
{
timeout,
interval: tick
}
interval: tick,
},
)
}

View file

@ -144,9 +144,7 @@
"external_url": "https:\/\/sealion.club\/notice\/957950",
"in_reply_to_profileurl": "https:\/\/shitposter.club\/moonman",
"in_reply_to_ostatus_uri": "https:\/\/shitposter.club\/user\/1",
"attentions": [
],
"attentions": [],
"fave_num": 0,
"repeat_num": 0,
"is_post_verb": false,
@ -229,9 +227,7 @@
"external_url": "https:\/\/soykaf.com\/notice\/339506",
"in_reply_to_profileurl": null,
"in_reply_to_ostatus_uri": null,
"attentions": [
],
"attentions": [],
"fave_num": 0,
"repeat_num": 0,
"is_post_verb": true,
@ -629,9 +625,7 @@
"external_url": "https:\/\/soykaf.com\/notice\/339502",
"in_reply_to_profileurl": "https:\/\/gs.smuglo.li\/jimrusell01",
"in_reply_to_ostatus_uri": "https:\/\/gs.smuglo.li\/user\/1987",
"attentions": [
],
"attentions": [],
"fave_num": 0,
"repeat_num": 0,
"is_post_verb": false,
@ -806,9 +800,7 @@
"external_url": "https:\/\/status.akionux.net\/notice\/359563",
"in_reply_to_profileurl": null,
"in_reply_to_ostatus_uri": null,
"attentions": [
],
"attentions": [],
"fave_num": 0,
"repeat_num": 0,
"is_post_verb": true,
@ -975,9 +967,7 @@
"external_url": "https:\/\/gs.smuglo.li\/notice\/589590",
"in_reply_to_profileurl": null,
"in_reply_to_ostatus_uri": null,
"attentions": [
],
"attentions": [],
"fave_num": 0,
"repeat_num": 0,
"is_post_verb": true,
@ -1046,9 +1036,7 @@
"external_url": "https:\/\/shitposter.club\/notice\/773502",
"in_reply_to_profileurl": "https:\/\/gs.smuglo.li\/jimrusell01",
"in_reply_to_ostatus_uri": "https:\/\/gs.smuglo.li\/user\/1987",
"attentions": [
],
"attentions": [],
"fave_num": 0,
"repeat_num": 0,
"is_post_verb": false,
@ -1131,9 +1119,7 @@
"external_url": "https:\/\/gs.smuglo.li\/notice\/589587",
"in_reply_to_profileurl": null,
"in_reply_to_ostatus_uri": null,
"attentions": [
],
"attentions": [],
"fave_num": 2,
"repeat_num": 0,
"is_post_verb": true,
@ -1224,9 +1210,7 @@
"external_url": "https:\/\/shitposter.club\/notice\/773500",
"in_reply_to_profileurl": null,
"in_reply_to_ostatus_uri": null,
"attentions": [
],
"attentions": [],
"fave_num": 0,
"repeat_num": 0,
"is_post_verb": true,
@ -1561,9 +1545,7 @@
"external_url": "https:\/\/soykaf.com\/notice\/339493",
"in_reply_to_profileurl": null,
"in_reply_to_ostatus_uri": null,
"attentions": [
],
"attentions": [],
"fave_num": 0,
"repeat_num": 0,
"is_post_verb": true,