Skip to content

Commit

Permalink
#178: fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
basmasking committed Jun 16, 2024
1 parent 724d062 commit 4ec9af7
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
12 changes: 6 additions & 6 deletions test/domain/relation/explore.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ describe('domain/relation/explore', () =>
{
it('should explore relations based on popularity', async () =>
{
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR);
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, undefined, VALUES.RANGE);
expect(relations).toHaveLength(3);
expect(relations[0].following?.id).toBe(VALUES.IDS.CREATOR5);
expect(relations[1].following?.id).toBe(VALUES.IDS.CREATOR4);
Expand All @@ -24,7 +24,7 @@ describe('domain/relation/explore', () =>

it('should explore relations based on recent', async () =>
{
const relations = await explore(REQUESTERS.FIRST, SortOrder.RECENT);
const relations = await explore(REQUESTERS.FIRST, SortOrder.RECENT, undefined, VALUES.RANGE);
expect(relations).toHaveLength(3);
expect(relations[0].following?.id).toBe(VALUES.IDS.CREATOR4);
expect(relations[1].following?.id).toBe(VALUES.IDS.CREATOR6);
Expand All @@ -33,27 +33,27 @@ describe('domain/relation/explore', () =>

it('should find no relations based on search', async () =>
{
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, 'or2');
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, 'or2', VALUES.RANGE);
expect(relations).toHaveLength(0);
});

it('should find relations based on search full name', async () =>
{
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, 'or 4');
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, 'or 4', VALUES.RANGE);
expect(relations).toHaveLength(1);
expect(relations[0].following?.id).toBe(VALUES.IDS.CREATOR4);
});

it('should find relations based on search nickname', async () =>
{
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, 'creator4');
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, 'creator4', VALUES.RANGE);
expect(relations).toHaveLength(1);
expect(relations[0].following?.id).toBe(VALUES.IDS.CREATOR4);
});

it('should find relations based on search full name and nickname', async () =>
{
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, 'five');
const relations = await explore(REQUESTERS.FIRST, SortOrder.POPULAR, 'five', VALUES.RANGE);
expect(relations).toHaveLength(2);
expect(relations[0].following?.id).toBe(VALUES.IDS.CREATOR5);
expect(relations[1].following?.id).toBe(VALUES.IDS.CREATOR6);
Expand Down
3 changes: 2 additions & 1 deletion test/domain/relation/fixtures/values.fixture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,6 @@ export const VALUES =
RELATION7: '7',

INVALID: 'A'.repeat(40)
}
},
RANGE: { limit: 30, offset: 0 }
};
2 changes: 1 addition & 1 deletion test/domain/relation/getFollowers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('domain/relation/getFollowers', () =>
{
it('should retrieve follower relations for a following creator', async () =>
{
const relations = await getFollowers(REQUESTERS.FIRST, VALUES.IDS.CREATOR3);
const relations = await getFollowers(REQUESTERS.FIRST, VALUES.IDS.CREATOR3, VALUES.RANGE);
expect(relations).toHaveLength(2);
expect(relations[0].following?.id).toBe(VALUES.IDS.CREATOR1);
expect(relations[1].following?.id).toBe(VALUES.IDS.CREATOR2);
Expand Down
2 changes: 1 addition & 1 deletion test/domain/relation/getFollowing.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ describe('domain/relation/getFollowing', () =>
{
it('should retrieve relations for a follower', async () =>
{
const relations = await getFollowing(REQUESTERS.FIRST, VALUES.IDS.CREATOR1);
const relations = await getFollowing(REQUESTERS.FIRST, VALUES.IDS.CREATOR1, VALUES.RANGE);
expect(relations).toHaveLength(2);
expect(relations[0].following?.id).toBe(VALUES.IDS.CREATOR2);
expect(relations[1].following?.id).toBe(VALUES.IDS.CREATOR3);
Expand Down

0 comments on commit 4ec9af7

Please sign in to comment.