Skip to content

Instantly share code, notes, and snippets.

@YonatanKra
Created December 16, 2024 13:37
Show Gist options
  • Save YonatanKra/2f95726b6d3447f260cbe985c3de4f6c to your computer and use it in GitHub Desktop.
Save YonatanKra/2f95726b6d3447f260cbe985c3de4f6c to your computer and use it in GitHub Desktop.
const resetAtpAgentMock = () => {
mockAtpAgent = {
getPost: vi.fn(),
resolveHandle: vi.fn().mockResolvedValue({
data: resolvedHandle
}),
login: vi.fn()
};
}
describe('login', () => {
it('should login using AtProto SDK', async () => {
const handle = 'testUser';
const password = 'testPassword';
await bot.login(handle, password);
expect(mockAtpAgent.login).toHaveBeenCalledWith({
identifier: handle,
password: password,
});
});
});
async login(handle: string, password: string): Promise<void> {
await this.#agent.login({
identifier: handle,
password: password
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment