Skip to content

The agent that grows with you

fmt(js): `npm run fix` on merge (#107097)

hermes-seaeye[bot]7cdc6a733883
diff --git a/apps/desktop/src/contrib/radio-artist-links.test.ts b/apps/desktop/src/contrib/radio-artist-links.test.ts
index 7042b36cce5..9374949c4e2 100644
--- a/apps/desktop/src/contrib/radio-artist-links.test.ts
+++ b/apps/desktop/src/contrib/radio-artist-links.test.ts
@@ -4,7 +4,11 @@ import { createPluginContext } from './plugin'
interface ArtistModule {
artistProfile: (relations: unknown[]) => string | null
- resolveArtist: (name: string, signal: AbortSignal, ctx: ReturnType<typeof createPluginContext>) => Promise<string | null>
+ resolveArtist: (
+ name: string,
+ signal: AbortSignal,
+ ctx: ReturnType<typeof createPluginContext>
+ ) => Promise<string | null>
trackCredit: (source: unknown) => { artist: string; title: string }
}
@@ -24,23 +28,25 @@ afterEach(() => {
describe('Radio artist credits', () => {
it('separates only a credited artist and accepts direct artist destinations, never track or search links', () => {
expect(trackCredit({ title: 'AC-DC - Thunderstruck' })).toEqual({ artist: 'AC-DC', title: 'Thunderstruck' })
- expect(trackCredit({ artist: 'AC-DC', title: 'Live - Part Two' })).toEqual({ artist: 'AC-DC', title: 'Live - Part Two' })
+ expect(trackCredit({ artist: 'AC-DC', title: 'Live - Part Two' })).toEqual({
+ artist: 'AC-DC',
+ title: 'Live - Part Two'
+ })
expect(trackCredit({ title: 'Unstructured broadcast' }).artist).toBe('')
expect(trackCredit(null).artist).toBe('')
const spotify = 'https://open.spotify.com/artist/5V8x0GqH9GCBPl1fYeOhuB'
const bandcamp = 'https://davdralleon.bandcamp.com/'
const relation = (type: string, resource: string) => ({ type, url: { resource } })
- expect(artistProfile([
- relation('bandcamp', bandcamp),
- relation('free streaming', spotify)
- ])).toBe(spotify)
- expect(artistProfile([
- relation('free streaming', 'https://open.spotify.com/track/5V8x0GqH9GCBPl1fYeOhuB'),
- relation('free streaming', 'https://open.spotify.com/search/Dav'),
- relation('bandcamp', `${bandcamp}track/song`),
- relation('official homepage', 'javascript:alert(1)')
- ])).toBeNull()
+ expect(artistProfile([relation('bandcamp', bandcamp), relation('free streaming', spotify)])).toBe(spotify)
+ expect(
+ artistProfile([
+ relation('free streaming', 'https://open.spotify.com/track/5V8x0GqH9GCBPl1fYeOhuB'),
+ relation('free streaming', 'https://open.spotify.com/search/Dav'),
+ relation('bandcamp', `${bandcamp}track/song`),
+ relation('official homepage', 'javascript:alert(1)')
+ ])
+ ).toBeNull()
expect(artistProfile([relation('bandcamp', bandcamp)])).toBe(bandcamp)
})
@@ -55,16 +61,21 @@ describe('Radio artist credits', () => {
expect(request.searchParams.get('term')).toBe('Hello Meteor')
expect(fetch).toHaveBeenCalledTimes(1)
- fetch.mockResolvedValueOnce(json({ results: [row, { ...row, artistLinkUrl: 'https://music.apple.com/us/artist/hello-meteor/2' }] }))
+ fetch.mockResolvedValueOnce(
+ json({ results: [row, { ...row, artistLinkUrl: 'https://music.apple.com/us/artist/hello-meteor/2' }] })
+ )
expect(await resolveArtist('Hello Meteor', signal(), ctx)).toBeNull()
expect(fetch).toHaveBeenCalledTimes(2)
const id = '08d6699f-ec17-434c-a922-3684531840d1'
const spotify = 'https://open.spotify.com/artist/5V8x0GqH9GCBPl1fYeOhuB'
- vi.stubGlobal('navigator', { locks: {
- request: async (_name: string, _options: unknown, callback: () => Promise<unknown>) => callback()
- } })
- fetch.mockRejectedValueOnce(new Error('Apple unavailable'))
+ vi.stubGlobal('navigator', {
+ locks: {
+ request: async (_name: string, _options: unknown, callback: () => Promise<unknown>) => callback()
+ }
+ })
+ fetch
+ .mockRejectedValueOnce(new Error('Apple unavailable'))
.mockResolvedValueOnce(json({ artists: [{ name: 'Dav Dralleon', id, score: 100 }] }))
.mockResolvedValueOnce(json({ relations: [{ type: 'free streaming', url: { resource: spotify } }] }))
expect(await resolveArtist('Dav Dralleon', signal(), ctx)).toBe(spotify)