Skip to content

Commit c551ecf

Browse files
committed
chore(tests): Add integrated tests for newly added APIs
1 parent 8f0d21b commit c551ecf

File tree

4 files changed

+34
-1
lines changed

4 files changed

+34
-1
lines changed

docker-compose.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ services:
2323

2424
mastodon:
2525
restart: always
26-
image: neetshin/mastodon-dev:4.3.0
26+
image: neetshin/mastodon-dev:4.4.0
2727
ports:
2828
- "3000:3000"
2929
- "4000:4000"

tests/rest/v1/accounts.spec.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -321,4 +321,25 @@ describe("account", () => {
321321
});
322322
expect(rel.followedBy).toBe(false);
323323
});
324+
325+
it("endorses/unendorses an account", async () => {
326+
await using alice = await sessions.acquire();
327+
await using bob = await sessions.acquire();
328+
329+
try {
330+
await alice.rest.v1.accounts.$select(bob.id).follow();
331+
const relationship = await alice.rest.v1.accounts
332+
.$select(bob.id)
333+
.endorse();
334+
expect(relationship.endorsed).toBe(true);
335+
336+
const endorsements = await alice.rest.v1.accounts
337+
.$select(alice.id)
338+
.endorsements.list();
339+
expect(endorsements).toContainEqual(bob.account);
340+
} finally {
341+
await alice.rest.v1.accounts.$select(bob.id).unendorse();
342+
await alice.rest.v1.accounts.$select(bob.id).unfollow();
343+
}
344+
});
324345
});

tests/rest/v1/emails.spec.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ it("can create a confirmation", async () => {
1212
password: "password",
1313
agreement: true,
1414
locale: "en",
15+
dateOfBirth: new Date("2000-01-01").toISOString(),
1516
});
1617

1718
const client = createRestAPIClient({

tests/rest/v1/tags.spec.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,15 @@ describe("FollowedTag", () => {
1414

1515
expect(tag.following).toBe(false);
1616
});
17+
18+
it("features/unfeatures a tag", async () => {
19+
await using session = await sessions.acquire();
20+
21+
let tag = await session.rest.v1.tags.$select("mastodon").feature();
22+
expect(tag.featuring).toBe(true);
23+
24+
await session.rest.v1.tags.$select("mastodon").unfeature();
25+
tag = await session.rest.v1.tags.$select("mastodon").fetch();
26+
expect(tag.featuring).toBe(false);
27+
});
1728
});

0 commit comments

Comments
 (0)