Skip to content

Commit

Permalink
Fix snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
blueridger committed Feb 16, 2022
1 parent 99aff2d commit d8bc782
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 45 deletions.
4 changes: 4 additions & 0 deletions packages/sourcecred/src/plugins/discord/config.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ describe("plugins/discord/config", () => {
},
includeNsfwChannels: true,
simplifyGraph: true,
beginningDate: 123,
},
];
const expected = [
Expand Down Expand Up @@ -63,6 +64,7 @@ describe("plugins/discord/config", () => {
},
includeNsfwChannels: true,
simplifyGraph: true,
beginningTimestampMs: 123,
},
];
const parsed: DiscordConfigs = parser.parseOrThrow(raw);
Expand Down Expand Up @@ -93,6 +95,7 @@ describe("plugins/discord/config", () => {
});
expect(parsed[0].includeNsfwChannels).toEqual(false);
expect(parsed[0].simplifyGraph).toEqual(false);
expect(parsed[0].beginningTimestampMs).toEqual(-Infinity);
});
it("can work with delimiters", () => {
const raw = [
Expand Down Expand Up @@ -153,6 +156,7 @@ describe("plugins/discord/config", () => {
},
includeNsfwChannels: true,
simplifyGraph: false,
beginningTimestampMs: -Infinity,
},
];
const parsed: DiscordConfigs = parser.parseOrThrow(raw);
Expand Down
2 changes: 1 addition & 1 deletion packages/sourcecred/src/plugins/discord/fetcher.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe("plugins/discord/fetcher", () => {
});
it("loads messages", async () => {
expect(
await snapshotFetcher().messages(channelId, "0", 10)
await snapshotFetcher().messages(channelId, "", 10)
).toMatchSnapshot();
expect(
await snapshotFetcher().messages(channelId, "678394455849566208", 10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@
"user": {
"id": "579830927287386126",
"username": "sandpiper",
"avatar": "8e387caf00d84b7fec05385da5a8cfef",
"avatar": "1381798c3bb36e75de39d60378efca63",
"discriminator": "3969",
"public_flags": 0
},
Expand All @@ -184,8 +184,8 @@
"communication_disabled_until": null,
"user": {
"id": "664562775770791966",
"username": "BrianBelhumeur",
"avatar": "02425177ceec3724217793f7e26b2b7b",
"username": "Beez",
"avatar": null,
"discriminator": "7902",
"public_flags": 0
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@
"mfa_level": 0,
"explicit_content_filter": 2,
"max_presences": null,
"max_members": 250000,
"max_members": 500000,
"max_video_channel_users": 25,
"vanity_url_code": null,
"premium_tier": 0,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
[
{
"id": "678394455849566208",
"type": 0,
"content": "10",
"channel_id": "678394406507905129",
"author": {
"id": "143776454050709505",
"username": "Beanow",
"avatar": "6496446fe1455f31f9536b132dcc4ac8",
"discriminator": "5887",
"public_flags": 0
},
"attachments": [],
"embeds": [],
"mentions": [],
"mention_roles": [],
"pinned": false,
"mention_everyone": false,
"tts": false,
"timestamp": "2020-02-16T00:17:22.234000+00:00",
"edited_timestamp": "2020-02-16T00:17:38.520000+00:00",
"flags": 0,
"components": []
},
{
"id": "678394451462193154",
"type": 0,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@
"guild_id": "678348980639498428",
"permission_overwrites": [],
"nsfw": false,
"rate_limit_per_user": 0,
"banner": null
"rate_limit_per_user": 0
},
{
"id": "678348980878573661",
Expand All @@ -58,8 +57,7 @@
"guild_id": "678348980639498428",
"permission_overwrites": [],
"nsfw": false,
"rate_limit_per_user": 0,
"banner": null
"rate_limit_per_user": 0
},
{
"id": "678696874869522446",
Expand All @@ -72,8 +70,7 @@
"guild_id": "678348980639498428",
"permission_overwrites": [],
"nsfw": false,
"rate_limit_per_user": 0,
"banner": null
"rate_limit_per_user": 0
},
{
"id": "830088231538130964",
Expand All @@ -95,12 +92,11 @@
}
],
"nsfw": false,
"rate_limit_per_user": 0,
"banner": null
"rate_limit_per_user": 0
},
{
"id": "830088231538130965",
"last_message_id": "909355881186066502",
"last_message_id": "923165455043166208",
"type": 0,
"name": "moderator-only",
"position": 0,
Expand All @@ -118,8 +114,7 @@
}
],
"nsfw": false,
"rate_limit_per_user": 0,
"banner": null
"rate_limit_per_user": 0
},
{
"id": "830089044695187586",
Expand Down Expand Up @@ -155,7 +150,6 @@
"guild_id": "678348980639498428",
"permission_overwrites": [],
"nsfw": true,
"rate_limit_per_user": 0,
"banner": null
"rate_limit_per_user": 0
}
]
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ cd "${CORE_PATH}"

fetch() {
url="${test_instance_url}$1"
filename="$(printf '%s' "${url}" | shasum -a 256 -U | cut -d' ' -f1)"
filename="$(printf '%s' "${url}" | shasum -a 256 | cut -d' ' -f1)"
path="${snapshots_dir}/${filename}"
curl -sfL "$url" \
-H "Accept: application/json" \
Expand All @@ -45,6 +45,6 @@ fetch "/guilds/$GUILD_ID/channels"
fetch "/guilds/$GUILD_ID/roles"
fetch "/guilds/$GUILD_ID/emojis"
fetch "/guilds/$GUILD_ID/members?after=0&limit=1000"
fetch "/channels/$CHANNEL_ID/messages?after=0&limit=10"
fetch "/channels/$CHANNEL_ID/messages?after=678394455849566208&limit=10"
fetch "/channels/$CHANNEL_ID/messages?limit=10"
fetch "/channels/$CHANNEL_ID/messages?before=678394455849566208&limit=10"
fetch "/channels/$CHANNEL_ID/messages/$MESSAGE_ID/reactions/$EMOJI_NAME:$EMOJI_ID?after=0&limit=100"

0 comments on commit d8bc782

Please sign in to comment.