@@ -3,7 +3,7 @@ import { TID } from '@atproto/common-web'
33import {
44 AppBskyActorDefs ,
55 AppBskyActorProfile ,
6- BskyAgent ,
6+ AtpAgent ,
77 ComAtprotoRepoPutRecord ,
88 DEFAULT_LABEL_SETTINGS ,
99} from '../src'
@@ -27,7 +27,7 @@ describe('agent', () => {
2727 } )
2828
2929 const getProfileDisplayName = async (
30- agent : BskyAgent ,
30+ agent : AtpAgent ,
3131 ) : Promise < string | undefined > => {
3232 try {
3333 const res = await agent . app . bsky . actor . profile . get ( {
@@ -41,14 +41,14 @@ describe('agent', () => {
4141 }
4242
4343 it ( 'clones correctly' , ( ) => {
44- const agent = new BskyAgent ( { service : network . pds . url } )
44+ const agent = new AtpAgent ( { service : network . pds . url } )
4545 const agent2 = agent . clone ( )
46- expect ( agent2 instanceof BskyAgent ) . toBeTruthy ( )
46+ expect ( agent2 instanceof AtpAgent ) . toBeTruthy ( )
4747 expect ( agent . service ) . toEqual ( agent2 . service )
4848 } )
4949
5050 it ( 'upsertProfile correctly creates and updates profiles.' , async ( ) => {
51- const agent = new BskyAgent ( { service : network . pds . url } )
51+ const agent = new AtpAgent ( { service : network . pds . url } )
5252
5353 await agent . createAccount ( {
5454 handle : 'user1.test' ,
@@ -80,7 +80,7 @@ describe('agent', () => {
8080 } )
8181
8282 it ( 'upsertProfile correctly handles CAS failures.' , async ( ) => {
83- const agent = new BskyAgent ( { service : network . pds . url } )
83+ const agent = new AtpAgent ( { service : network . pds . url } )
8484 await agent . createAccount ( {
8585 handle : 'user2.test' ,
8686@@ -118,7 +118,7 @@ describe('agent', () => {
118118 } )
119119
120120 it ( 'upsertProfile wont endlessly retry CAS failures.' , async ( ) => {
121- const agent = new BskyAgent ( { service : network . pds . url } )
121+ const agent = new AtpAgent ( { service : network . pds . url } )
122122 await agent . createAccount ( {
123123 handle : 'user3.test' ,
124124@@ -146,7 +146,7 @@ describe('agent', () => {
146146 } )
147147
148148 it ( 'upsertProfile validates the record.' , async ( ) => {
149- const agent = new BskyAgent ( { service : network . pds . url } )
149+ const agent = new AtpAgent ( { service : network . pds . url } )
150150 await agent . createAccount ( {
151151 handle : 'user4.test' ,
152152@@ -163,78 +163,78 @@ describe('agent', () => {
163163
164164 describe ( 'app' , ( ) => {
165165 it ( 'should retrieve the api app' , ( ) => {
166- const agent = new BskyAgent ( { service : network . pds . url } )
166+ const agent = new AtpAgent ( { service : network . pds . url } )
167167 expect ( agent . api ) . toBe ( agent )
168168 expect ( agent . app ) . toBeDefined ( )
169169 } )
170170 } )
171171
172172 describe ( 'post' , ( ) => {
173173 it ( 'should throw if no session' , async ( ) => {
174- const agent = new BskyAgent ( { service : network . pds . url } )
174+ const agent = new AtpAgent ( { service : network . pds . url } )
175175 await expect ( agent . post ( { text : 'foo' } ) ) . rejects . toThrow ( 'Not logged in' )
176176 } )
177177 } )
178178
179179 describe ( 'deletePost' , ( ) => {
180180 it ( 'should throw if no session' , async ( ) => {
181- const agent = new BskyAgent ( { service : network . pds . url } )
181+ const agent = new AtpAgent ( { service : network . pds . url } )
182182 await expect ( agent . deletePost ( 'foo' ) ) . rejects . toThrow ( 'Not logged in' )
183183 } )
184184 } )
185185
186186 describe ( 'like' , ( ) => {
187187 it ( 'should throw if no session' , async ( ) => {
188- const agent = new BskyAgent ( { service : network . pds . url } )
188+ const agent = new AtpAgent ( { service : network . pds . url } )
189189 await expect ( agent . like ( 'foo' , 'bar' ) ) . rejects . toThrow ( 'Not logged in' )
190190 } )
191191 } )
192192
193193 describe ( 'deleteLike' , ( ) => {
194194 it ( 'should throw if no session' , async ( ) => {
195- const agent = new BskyAgent ( { service : network . pds . url } )
195+ const agent = new AtpAgent ( { service : network . pds . url } )
196196 await expect ( agent . deleteLike ( 'foo' ) ) . rejects . toThrow ( 'Not logged in' )
197197 } )
198198 } )
199199
200200 describe ( 'repost' , ( ) => {
201201 it ( 'should throw if no session' , async ( ) => {
202- const agent = new BskyAgent ( { service : network . pds . url } )
202+ const agent = new AtpAgent ( { service : network . pds . url } )
203203 await expect ( agent . repost ( 'foo' , 'bar' ) ) . rejects . toThrow ( 'Not logged in' )
204204 } )
205205 } )
206206
207207 describe ( 'deleteRepost' , ( ) => {
208208 it ( 'should throw if no session' , async ( ) => {
209- const agent = new BskyAgent ( { service : network . pds . url } )
209+ const agent = new AtpAgent ( { service : network . pds . url } )
210210 await expect ( agent . deleteRepost ( 'foo' ) ) . rejects . toThrow ( 'Not logged in' )
211211 } )
212212 } )
213213
214214 describe ( 'follow' , ( ) => {
215215 it ( 'should throw if no session' , async ( ) => {
216- const agent = new BskyAgent ( { service : network . pds . url } )
216+ const agent = new AtpAgent ( { service : network . pds . url } )
217217 await expect ( agent . follow ( 'foo' ) ) . rejects . toThrow ( 'Not logged in' )
218218 } )
219219 } )
220220
221221 describe ( 'deleteFollow' , ( ) => {
222222 it ( 'should throw if no session' , async ( ) => {
223- const agent = new BskyAgent ( { service : network . pds . url } )
223+ const agent = new AtpAgent ( { service : network . pds . url } )
224224 await expect ( agent . deleteFollow ( 'foo' ) ) . rejects . toThrow ( 'Not logged in' )
225225 } )
226226 } )
227227
228228 describe ( 'preferences methods' , ( ) => {
229229 it ( 'gets and sets preferences correctly' , async ( ) => {
230- const agent = new BskyAgent ( { service : network . pds . url } )
230+ const agent = new AtpAgent ( { service : network . pds . url } )
231231 await agent . createAccount ( {
232232 handle : 'user5.test' ,
233233234234 password : 'password' ,
235235 } )
236236
237- const DEFAULT_LABELERS = BskyAgent . appLabelers . map ( ( did ) => ( {
237+ const DEFAULT_LABELERS = AtpAgent . appLabelers . map ( ( did ) => ( {
238238 did,
239239 labels : { } ,
240240 } ) )
@@ -1174,7 +1174,7 @@ describe('agent', () => {
11741174 } )
11751175
11761176 it ( 'resolves duplicates correctly' , async ( ) => {
1177- const agent = new BskyAgent ( { service : network . pds . url } )
1177+ const agent = new AtpAgent ( { service : network . pds . url } )
11781178
11791179 await agent . createAccount ( {
11801180 handle : 'user6.test' ,
@@ -1318,7 +1318,7 @@ describe('agent', () => {
13181318 porn : 'warn' ,
13191319 } ,
13201320 labelers : [
1321- ...BskyAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
1321+ ...AtpAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
13221322 {
13231323 did : 'did:plc:first-labeler' ,
13241324 labels : { } ,
@@ -1376,7 +1376,7 @@ describe('agent', () => {
13761376 porn : 'warn' ,
13771377 } ,
13781378 labelers : [
1379- ...BskyAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
1379+ ...AtpAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
13801380 {
13811381 did : 'did:plc:first-labeler' ,
13821382 labels : { } ,
@@ -1435,7 +1435,7 @@ describe('agent', () => {
14351435 porn : 'ignore' ,
14361436 } ,
14371437 labelers : [
1438- ...BskyAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
1438+ ...AtpAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
14391439 {
14401440 did : 'did:plc:first-labeler' ,
14411441 labels : { } ,
@@ -1494,7 +1494,7 @@ describe('agent', () => {
14941494 porn : 'ignore' ,
14951495 } ,
14961496 labelers : [
1497- ...BskyAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
1497+ ...AtpAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
14981498 {
14991499 did : 'did:plc:first-labeler' ,
15001500 labels : { } ,
@@ -1549,7 +1549,7 @@ describe('agent', () => {
15491549 porn : 'ignore' ,
15501550 } ,
15511551 labelers : [
1552- ...BskyAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
1552+ ...AtpAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
15531553 {
15541554 did : 'did:plc:first-labeler' ,
15551555 labels : { } ,
@@ -1604,7 +1604,7 @@ describe('agent', () => {
16041604 porn : 'ignore' ,
16051605 } ,
16061606 labelers : [
1607- ...BskyAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
1607+ ...AtpAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
16081608 {
16091609 did : 'did:plc:first-labeler' ,
16101610 labels : { } ,
@@ -1671,7 +1671,7 @@ describe('agent', () => {
16711671 porn : 'ignore' ,
16721672 } ,
16731673 labelers : [
1674- ...BskyAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
1674+ ...AtpAgent . appLabelers . map ( ( did ) => ( { did, labels : { } } ) ) ,
16751675 {
16761676 did : 'did:plc:first-labeler' ,
16771677 labels : { } ,
@@ -1773,10 +1773,10 @@ describe('agent', () => {
17731773 } )
17741774
17751775 describe ( 'muted words' , ( ) => {
1776- let agent : BskyAgent
1776+ let agent : AtpAgent
17771777
17781778 beforeAll ( async ( ) => {
1779- agent = new BskyAgent ( { service : network . pds . url } )
1779+ agent = new AtpAgent ( { service : network . pds . url } )
17801780 await agent . createAccount ( {
17811781 handle : 'user7.test' ,
17821782@@ -2196,10 +2196,10 @@ describe('agent', () => {
21962196 } )
21972197
21982198 describe ( 'legacy muted words' , ( ) => {
2199- let agent : BskyAgent
2199+ let agent : AtpAgent
22002200
22012201 async function updatePreferences (
2202- agent : BskyAgent ,
2202+ agent : AtpAgent ,
22032203 cb : (
22042204 prefs : AppBskyActorDefs . Preferences ,
22052205 ) => AppBskyActorDefs . Preferences | false ,
@@ -2252,7 +2252,7 @@ describe('agent', () => {
22522252 }
22532253
22542254 beforeAll ( async ( ) => {
2255- agent = new BskyAgent ( { service : network . pds . url } )
2255+ agent = new AtpAgent ( { service : network . pds . url } )
22562256 await agent . createAccount ( {
22572257 handle : 'user7-1.test' ,
22582258@@ -2374,11 +2374,11 @@ describe('agent', () => {
23742374 } )
23752375
23762376 describe ( 'hidden posts' , ( ) => {
2377- let agent : BskyAgent
2377+ let agent : AtpAgent
23782378 const postUri = 'at://did:plc:fake/app.bsky.feed.post/fake'
23792379
23802380 beforeAll ( async ( ) => {
2381- agent = new BskyAgent ( { service : network . pds . url } )
2381+ agent = new AtpAgent ( { service : network . pds . url } )
23822382 await agent . createAccount ( {
23832383 handle : 'user8.test' ,
23842384@@ -2411,13 +2411,13 @@ describe('agent', () => {
24112411 } )
24122412
24132413 describe ( `saved feeds v2` , ( ) => {
2414- let agent : BskyAgent
2414+ let agent : AtpAgent
24152415 let i = 0
24162416 const feedUri = ( ) => `at://bob.com/app.bsky.feed.generator/${ i ++ } `
24172417 const listUri = ( ) => `at://bob.com/app.bsky.graph.list/${ i ++ } `
24182418
24192419 beforeAll ( async ( ) => {
2420- agent = new BskyAgent ( { service : network . pds . url } )
2420+ agent = new AtpAgent ( { service : network . pds . url } )
24212421 await agent . createAccount ( {
24222422 handle : 'user9.test' ,
24232423@@ -2885,12 +2885,12 @@ describe('agent', () => {
28852885 } )
28862886
28872887 describe ( `saved feeds v2: migration scenarios` , ( ) => {
2888- let agent : BskyAgent
2888+ let agent : AtpAgent
28892889 let i = 0
28902890 const feedUri = ( ) => `at://bob.com/app.bsky.feed.generator/${ i ++ } `
28912891
28922892 beforeAll ( async ( ) => {
2893- agent = new BskyAgent ( { service : network . pds . url } )
2893+ agent = new AtpAgent ( { service : network . pds . url } )
28942894 await agent . createAccount ( {
28952895 handle : 'user10.test' ,
28962896@@ -3205,7 +3205,7 @@ describe('agent', () => {
32053205
32063206 describe ( 'queued nudges' , ( ) => {
32073207 it ( 'queueNudges & dismissNudges' , async ( ) => {
3208- const agent = new BskyAgent ( { service : network . pds . url } )
3208+ const agent = new AtpAgent ( { service : network . pds . url } )
32093209 await agent . createAccount ( {
32103210 handle : 'user11.test' ,
32113211@@ -3236,7 +3236,7 @@ describe('agent', () => {
32363236
32373237 describe ( 'guided tours' , ( ) => {
32383238 it ( 'setActiveProgressGuide' , async ( ) => {
3239- const agent = new BskyAgent ( { service : network . pds . url } )
3239+ const agent = new AtpAgent ( { service : network . pds . url } )
32403240
32413241 await agent . createAccount ( {
32423242 handle : 'user12.test' ,
@@ -3273,7 +3273,7 @@ describe('agent', () => {
32733273 } )
32743274
32753275 describe ( 'nuxs' , ( ) => {
3276- let agent : BskyAgent
3276+ let agent : AtpAgent
32773277
32783278 const nux = {
32793279 id : 'a' ,
@@ -3283,7 +3283,7 @@ describe('agent', () => {
32833283 }
32843284
32853285 beforeAll ( async ( ) => {
3286- agent = new BskyAgent ( { service : network . pds . url } )
3286+ agent = new AtpAgent ( { service : network . pds . url } )
32873287
32883288 await agent . createAccount ( {
32893289 handle : 'nuxs.test' ,
0 commit comments