mirror of
https://github.com/misenhower/splatoon3.ink.git
synced 2026-09-28 01:56:27 -05:00
Use named Atproto API exports
Atproto 0.20 no longer includes BskyAgent or RichText on its default ESM export, which made BlueskyAgent construction fail at runtime.
This commit is contained in:
@@ -1,9 +1,7 @@
|
||||
import atprotoApi from '@atproto/api';
|
||||
import { BskyAgent, RichText } from '@atproto/api';
|
||||
import sharp from 'sharp';
|
||||
import Client from './Client.mjs';
|
||||
|
||||
const { BskyAgent, RichText } = atprotoApi;
|
||||
|
||||
export default class BlueskyClient extends Client
|
||||
{
|
||||
key = 'bluesky';
|
||||
|
||||
25
app/social/clients/BlueskyClient.test.mjs
Normal file
25
app/social/clients/BlueskyClient.test.mjs
Normal file
@@ -0,0 +1,25 @@
|
||||
import { afterEach, describe, expect, it, vi } from 'vitest';
|
||||
import { BskyAgent } from '@atproto/api';
|
||||
import BlueskyClient from './BlueskyClient.mjs';
|
||||
|
||||
describe('BlueskyClient', () => {
|
||||
afterEach(() => {
|
||||
vi.restoreAllMocks();
|
||||
vi.unstubAllEnvs();
|
||||
});
|
||||
|
||||
it('logs in with the current Atproto agent API', async () => {
|
||||
vi.stubEnv('BLUESKY_SERVICE', 'https://bsky.social');
|
||||
vi.stubEnv('BLUESKY_IDENTIFIER', 'test.bsky.social');
|
||||
vi.stubEnv('BLUESKY_PASSWORD', 'test-password');
|
||||
const login = vi.spyOn(BskyAgent.prototype, 'login').mockResolvedValue();
|
||||
const client = new BlueskyClient;
|
||||
|
||||
await client.login();
|
||||
|
||||
expect(login).toHaveBeenCalledWith({
|
||||
identifier: 'test.bsky.social',
|
||||
password: 'test-password',
|
||||
});
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user