-
Notifications
You must be signed in to change notification settings - Fork 466
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Filter out reference lists from
getLists
(#2629)
* filter out reference lists * appview: use a rule to exclude reference lists from getLists --------- Co-authored-by: Devin Ivy <[email protected]>
- Loading branch information
Showing
3 changed files
with
123 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
packages/bsky/tests/views/__snapshots__/lists.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`bsky actor likes feed views does not include reference lists in getActorLists 1`] = ` | ||
Array [ | ||
Object { | ||
"cid": "cids(0)", | ||
"creator": Object { | ||
"avatar": "https://bsky.public.url/img/avatar/plain/user(1)/cids(1)@jpeg", | ||
"createdAt": "1970-01-01T00:00:00.000Z", | ||
"description": "its me!", | ||
"did": "user(0)", | ||
"displayName": "ali", | ||
"handle": "alice.test", | ||
"indexedAt": "1970-01-01T00:00:00.000Z", | ||
"labels": Array [ | ||
Object { | ||
"cid": "cids(2)", | ||
"cts": "1970-01-01T00:00:00.000Z", | ||
"src": "user(0)", | ||
"uri": "record(1)", | ||
"val": "self-label-a", | ||
}, | ||
Object { | ||
"cid": "cids(2)", | ||
"cts": "1970-01-01T00:00:00.000Z", | ||
"src": "user(0)", | ||
"uri": "record(1)", | ||
"val": "self-label-b", | ||
}, | ||
], | ||
}, | ||
"description": "", | ||
"descriptionFacets": Array [], | ||
"indexedAt": "1970-01-01T00:00:00.000Z", | ||
"labels": Array [], | ||
"listItemCount": 0, | ||
"name": "cool curate list!", | ||
"purpose": "app.bsky.graph.defs#curatelist", | ||
"uri": "record(0)", | ||
}, | ||
] | ||
`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import AtpAgent from '@atproto/api' | ||
import { TestNetwork, SeedClient, basicSeed } from '@atproto/dev-env' | ||
import { forSnapshot } from '../_util' | ||
|
||
describe('bsky actor likes feed views', () => { | ||
let network: TestNetwork | ||
let agent: AtpAgent | ||
let pdsAgent: AtpAgent | ||
let sc: SeedClient | ||
|
||
beforeAll(async () => { | ||
network = await TestNetwork.create({ | ||
dbPostgresSchema: 'bsky_views_actor_lists', | ||
}) | ||
agent = network.bsky.getClient() | ||
pdsAgent = network.pds.getClient() | ||
sc = network.getSeedClient() | ||
await basicSeed(sc) | ||
await network.processAll() | ||
}) | ||
|
||
afterAll(async () => { | ||
await network.close() | ||
}) | ||
|
||
it('does not include reference lists in getActorLists', async () => { | ||
await pdsAgent.api.app.bsky.graph.list.create( | ||
{ | ||
repo: sc.dids.alice, | ||
}, | ||
{ | ||
name: 'awesome starter pack list!', | ||
description: '', | ||
descriptionFacets: [], | ||
avatar: undefined, | ||
createdAt: new Date().toISOString(), | ||
purpose: 'app.bsky.graph.defs#referencelist', | ||
}, | ||
sc.getHeaders(sc.dids.alice), | ||
) | ||
await pdsAgent.api.app.bsky.graph.list.create( | ||
{ | ||
repo: sc.dids.alice, | ||
}, | ||
{ | ||
name: 'cool curate list!', | ||
description: '', | ||
descriptionFacets: [], | ||
avatar: undefined, | ||
createdAt: new Date().toISOString(), | ||
purpose: 'app.bsky.graph.defs#curatelist', | ||
}, | ||
sc.getHeaders(sc.dids.alice), | ||
) | ||
await network.processAll() | ||
const view = await agent.api.app.bsky.graph.getLists({ | ||
actor: sc.dids.alice, | ||
}) | ||
expect(view.data.lists.length).toBe(1) | ||
expect(forSnapshot(view.data.lists)).toMatchSnapshot() | ||
}) | ||
}) |