mirror of
				https://github.com/NodeBB/NodeBB.git
				synced 2025-10-31 19:15:58 +01:00 
			
		
		
		
	test: have ap helper mocks for person and group auto-save to ap cache
This commit is contained in:
		| @@ -111,7 +111,6 @@ describe.only('Group assertion', () => { | |||||||
| 	before(async () => { | 	before(async () => { | ||||||
| 		const { id, actor } = helpers.mocks.group(); | 		const { id, actor } = helpers.mocks.group(); | ||||||
| 		actorUri = id; | 		actorUri = id; | ||||||
| 		activitypub._cache.set(`0;${id}`, actor); |  | ||||||
| 	}); | 	}); | ||||||
|  |  | ||||||
| 	it('should assert a uri identifying as "Group" into a remote category', async () => { | 	it('should assert a uri identifying as "Group" into a remote category', async () => { | ||||||
|   | |||||||
| @@ -38,7 +38,6 @@ describe('FEPs', () => { | |||||||
| 				uid = await user.create({ username: utils.generateUUID() }); | 				uid = await user.create({ username: utils.generateUUID() }); | ||||||
|  |  | ||||||
| 				const { id: followerId, actor } = helpers.mocks.person(); | 				const { id: followerId, actor } = helpers.mocks.person(); | ||||||
| 				activitypub._cache.set(`0;${followerId}`, actor); |  | ||||||
| 				user.setCategoryWatchState(followerId, [cid], categories.watchStates.tracking); | 				user.setCategoryWatchState(followerId, [cid], categories.watchStates.tracking); | ||||||
|  |  | ||||||
| 				activitypub._sent.clear(); | 				activitypub._sent.clear(); | ||||||
|   | |||||||
| @@ -34,6 +34,8 @@ Helpers.mocks.person = () => { | |||||||
| 		}, | 		}, | ||||||
| 	}; | 	}; | ||||||
|  |  | ||||||
|  | 	activitypub._cache.set(`0;${id}`, actor); | ||||||
|  |  | ||||||
| 	return { id, actor }; | 	return { id, actor }; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| @@ -41,6 +43,8 @@ Helpers.mocks.group = () => { | |||||||
| 	const { id, actor } = Helpers.mocks.person(); | 	const { id, actor } = Helpers.mocks.person(); | ||||||
| 	actor.type = 'Group'; | 	actor.type = 'Group'; | ||||||
|  |  | ||||||
|  | 	activitypub._cache.set(`0;${id}`, actor); | ||||||
|  |  | ||||||
| 	return { id, actor }; | 	return { id, actor }; | ||||||
| }; | }; | ||||||
|  |  | ||||||
|   | |||||||
| @@ -85,7 +85,6 @@ describe('Notes', () => { | |||||||
|  |  | ||||||
| 				it('should slot newly created topic in remote category if addressed', async () => { | 				it('should slot newly created topic in remote category if addressed', async () => { | ||||||
| 					const { id: cid, actor } = helpers.mocks.group(); | 					const { id: cid, actor } = helpers.mocks.group(); | ||||||
| 					activitypub._cache.set(`0;${cid}`, actor); |  | ||||||
| 					await activitypub.actors.assertGroup([cid]); | 					await activitypub.actors.assertGroup([cid]); | ||||||
|  |  | ||||||
| 					const { id } = helpers.mocks.note({ | 					const { id } = helpers.mocks.note({ | ||||||
| @@ -120,7 +119,6 @@ describe('Notes', () => { | |||||||
| 					// Remote | 					// Remote | ||||||
| 					const { id, actor } = helpers.mocks.group(); | 					const { id, actor } = helpers.mocks.group(); | ||||||
| 					remoteCid = id; | 					remoteCid = id; | ||||||
| 					activitypub._cache.set(`0;${id}`, actor); |  | ||||||
| 					await activitypub.actors.assertGroup([id]); | 					await activitypub.actors.assertGroup([id]); | ||||||
|  |  | ||||||
| 					// User | 					// User | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user