Skip to content

Commit

Permalink
fix: update so follow and followedBy returns data
Browse files Browse the repository at this point in the history
  • Loading branch information
juni-b-queer committed Oct 18, 2024
1 parent 83141b4 commit 1d844d3
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 23 deletions.
4 changes: 2 additions & 2 deletions src/agent/HandlerAgent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export class HandlerAgent {
limit: limit,
};
const resp = await this.agent?.getFollows(body);
return resp?.data.follows;
return resp?.data;
}

/**
Expand All @@ -133,7 +133,7 @@ export class HandlerAgent {
limit: limit,
};
const resp = await this.agent?.getFollowers(body);
return resp?.data.followers;
return resp?.data;
}

/**
Expand Down
42 changes: 21 additions & 21 deletions tests/agent/HandlerAgentFollow.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,37 +9,37 @@ describe('HandlerAgent', () => {
const testHandle: string = 'testhandle';
const testPassword: string = 'testpassword';

const followingMocks = [
{
did: 'isFollowing',
viewer: {
following: 'followLink',
const followingMocks = {
follows: [
{
did: 'isFollowing',
viewer: {
following: 'followLink',
},
},
},
];
],
};

const followedByMocks = [
{
did: 'isFollowedBy',
viewer: {
following: 'followLink',
followedBy: 'followedByLink',
const followedByMocks = {
followers: [
{
did: 'isFollowedBy',
viewer: {
following: 'followLink',
followedBy: 'followedByLink',
},
},
},
];
],
};
let getFollowsMock: jest.Mock<any, any, any>;
let getFollowersMock: jest.Mock<any, any, any>;
const followMock = jest.fn();
const deleteFollowMock = jest.fn();
let getProfileMock: jest.Mock<any, any, any>;
beforeEach(() => {
jest.clearAllMocks();
getFollowsMock = jest
.fn()
.mockReturnValue({ data: { follows: followingMocks } });
getFollowersMock = jest
.fn()
.mockReturnValue({ data: { followers: followedByMocks } });
getFollowsMock = jest.fn().mockReturnValue({ data: followingMocks });
getFollowersMock = jest.fn().mockReturnValue({ data: followedByMocks });

// Require mocked module and define class' methods
const mockedAgent = {
Expand Down

0 comments on commit 1d844d3

Please sign in to comment.