This repository has been archived by the owner on Sep 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Migrate all existing tests and modules to
camelCase
and fix …
…some lint errors (#61)
- Loading branch information
Showing
17 changed files
with
113 additions
and
144 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
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
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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -3,101 +3,86 @@ import { assertEquals } from "https://deno.land/[email protected]/assert/mod.ts"; | |
import { faker } from "https://deno.land/x/[email protected]/mod.ts"; | ||
|
||
test("e2e accept", async (ctx: TestContext) => { | ||
const { user: userA, token: tokenA } = await ctx.call("users", "register", { | ||
const { user: _userA, token: tokenA } = await ctx.modules.users.register({ | ||
username: faker.internet.userName(), | ||
identity: { guest: {} }, | ||
}) as any; | ||
}); | ||
|
||
const { user: userB, token: tokenB } = await ctx.call("users", "register", { | ||
const { user: userB, token: tokenB } = await ctx.modules.users.register({ | ||
username: faker.internet.userName(), | ||
identity: { guest: {} }, | ||
}) as any; | ||
}); | ||
|
||
const { friendRequest } = await ctx.call("friends", "send_request", { | ||
const { friendRequest } = await ctx.modules.friends.sendRequest({ | ||
userToken: tokenA.token, | ||
targetUserId: userB.id, | ||
}) as any; | ||
|
||
const { friendRequests: outgoingRequests } = await ctx.call( | ||
"friends", | ||
"list_outgoing_friend_requests", | ||
{ | ||
userToken: tokenA.token, | ||
}, | ||
) as any; | ||
}); | ||
|
||
const { friendRequests: outgoingRequests } = await ctx.modules.friends.listOutgoingFriendRequests({ | ||
userToken: tokenA.token, | ||
}); | ||
assertEquals(outgoingRequests.length, 1); | ||
|
||
const { friendRequests: incomingRequests } = await ctx.call( | ||
"friends", | ||
"list_incoming_friend_requests", | ||
{ | ||
userToken: tokenB.token, | ||
}, | ||
) as any; | ||
const { friendRequests: incomingRequests } = await ctx.modules.friends.listIncomingFriendRequests({ | ||
userToken: tokenB.token, | ||
}); | ||
assertEquals(incomingRequests.length, 1); | ||
|
||
await ctx.call("friends", "accept_request", { | ||
await ctx.modules.friends.acceptRequest({ | ||
userToken: tokenB.token, | ||
friendRequestId: friendRequest.id, | ||
}) as any; | ||
}); | ||
|
||
const friendsA = await ctx.call("friends", "list_friends", { | ||
const friendsA = await ctx.modules.friends.listFriends({ | ||
userToken: tokenA.token, | ||
}) as any; | ||
}); | ||
assertEquals(friendsA.friends.length, 1); | ||
|
||
const friendsB = await ctx.call("friends", "list_friends", { | ||
|
||
const friendsB = await ctx.modules.friends.listFriends({ | ||
userToken: tokenB.token, | ||
}) as any; | ||
}); | ||
assertEquals(friendsB.friends.length, 1); | ||
|
||
await ctx.call("friends", "remove_friend", { | ||
await ctx.modules.friends.removeFriend({ | ||
userToken: tokenA.token, | ||
targetUserId: userB.id, | ||
}) as any; | ||
}); | ||
|
||
const friendsRemoved = await ctx.call("friends", "list_friends", { | ||
const friendsRemoved = await ctx.modules.friends.listFriends({ | ||
userToken: tokenB.token, | ||
}) as any; | ||
}); | ||
assertEquals(friendsRemoved.friends.length, 0); | ||
}); | ||
|
||
test("e2e reject", async (ctx: TestContext) => { | ||
const { user: userA, token: tokenA } = await ctx.call("users", "register", { | ||
const { user: _userA, token: tokenA } = await ctx.modules.users.register({ | ||
username: faker.internet.userName(), | ||
identity: { guest: {} }, | ||
}) as any; | ||
}); | ||
|
||
const { user: userB, token: tokenB } = await ctx.call("users", "register", { | ||
const { user: userB, token: tokenB } = await ctx.modules.users.register({ | ||
username: faker.internet.userName(), | ||
identity: { guest: {} }, | ||
}) as any; | ||
}); | ||
|
||
const { friendRequest } = await ctx.call("friends", "send_request", { | ||
const { friendRequest } = await ctx.modules.friends.sendRequest({ | ||
userToken: tokenA.token, | ||
targetUserId: userB.id, | ||
}) as any; | ||
}); | ||
|
||
await ctx.call("friends", "decline_request", { | ||
await ctx.modules.friends.declineRequest({ | ||
userToken: tokenB.token, | ||
friendRequestId: friendRequest.id, | ||
}) as any; | ||
|
||
const { friendRequests: outgoingRequests } = await ctx.call( | ||
"friends", | ||
"list_outgoing_friend_requests", | ||
{ | ||
userToken: tokenA.token, | ||
}, | ||
) as any; | ||
}); | ||
|
||
const { friendRequests: outgoingRequests } = await ctx.modules.friends.listOutgoingFriendRequests({ | ||
userToken: tokenA.token, | ||
}); | ||
assertEquals(outgoingRequests.length, 0); | ||
|
||
const { friendRequests: incomingRequests } = await ctx.call( | ||
"friends", | ||
"list_incoming_friend_requests", | ||
{ | ||
userToken: tokenB.token, | ||
}, | ||
) as any; | ||
const { friendRequests: incomingRequests } = await ctx.modules.friends.listIncomingFriendRequests({ | ||
userToken: tokenB.token, | ||
}); | ||
assertEquals(incomingRequests.length, 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
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
Oops, something went wrong.