atproto/packages/api/tests/errors.test.ts
Matthieu Sieben 61dc0d60e1
Add linting rule to sort imports (#3220)
* Add linting rule to sort imports

* remove spacing between import groups

* changeset

* changeset

* prettier config fine tuning

* forbid use of deprecated imports

* tidy
2025-02-05 15:06:58 +01:00

30 lines
757 B
TypeScript

import { TestNetworkNoAppView } from '@atproto/dev-env'
import { AtpAgent, ComAtprotoServerCreateAccount } from '..'
describe('errors', () => {
let network: TestNetworkNoAppView
let client: AtpAgent
beforeAll(async () => {
network = await TestNetworkNoAppView.create({
dbPostgresSchema: 'known_errors',
})
client = network.pds.getClient()
})
afterAll(async () => {
await network.close()
})
it('constructs the correct error instance', async () => {
const res = client.api.com.atproto.server.createAccount({
handle: 'admin.blah',
email: 'admin@test.com',
password: 'password',
})
await expect(res).rejects.toThrow(
ComAtprotoServerCreateAccount.UnsupportedDomainError,
)
})
})