Skip to content

Commit

Permalink
api/test: add test for private instagram posts
Browse files Browse the repository at this point in the history
  • Loading branch information
dumbmoron committed Feb 9, 2025
1 parent 20525d6 commit 59cb6b0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/src/misc/run-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ export async function runTest(url, params, expect) {
error.push(`status mismatch: ${detail}`);
}

if (expect.errorCode && expect.errorCode !== result.body?.error?.code) {
const detail = `${expect.errorCode} (expected) != ${result.body.error.code} (actual)`
error.push(`error mismatch: ${detail}`);
}

if (expect.code !== result.status) {
const detail = `${expect.code} (expected) != ${result.status} (actual)`;
error.push(`status code mismatch: ${detail}`);
Expand Down
10 changes: 10 additions & 0 deletions api/src/util/tests/instagram.json
Original file line number Diff line number Diff line change
Expand Up @@ -119,5 +119,15 @@
"code": 200,
"status": "redirect"
}
},
{
"name": "private instagram post",
"url": "https://www.instagram.com/p/C5_A1TQNPrYw4c2g9KAUTPUl8RVHqiAdAcOOSY0",
"params": {},
"expected": {
"code": 400,
"status": "error",
"errorCode": "error.api.content.post.private"
}
}
]

0 comments on commit 59cb6b0

Please sign in to comment.