-
Notifications
You must be signed in to change notification settings - Fork 97
chore: create twitch proxy tests #617
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ojeytonwilliams
merged 6 commits into
freeCodeCamp:main
from
a2937:chore/create-twitch-proxy-tests
Oct 24, 2024
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
977fca8
chore: create twitch proxy tests
a2937 5788449
log results
a2937 b2bef65
bypass broken api key call
a2937 a5b962c
restore update function and remove helix tests
a2937 62c75cb
chore: set url for gitpod testing
ShaunSHamilton 3f92ca0
fix: shaun forgets localhost is not secure
ShaunSHamilton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| const config = { | ||
| roots: ['./test/'] | ||
| roots: ['./test/'], | ||
| setupFiles: ['dotenv/config'] | ||
| }; | ||
|
|
||
| module.exports = config; |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| const baseUrl = port => { | ||
| if (process.env.DEMO_APPS_DOMAIN === 'localhost') { | ||
| const url = new URL('http://localhost'); | ||
| url.port = port; | ||
| return url; | ||
| } | ||
|
|
||
| if (process.env.GITPOD_HOST) { | ||
| const url = new URL( | ||
| `https://${port}-${process.env.GITPOD_WORKSPACE_ID}.${process.env.GITPOD_WORKSPACE_CLUSTER_HOST}` | ||
| ); | ||
| return url; | ||
| } | ||
| }; | ||
|
|
||
| module.exports = { | ||
| baseUrl | ||
| }; |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| // TODO: Remove once types for Jest are recognized | ||
| /* eslint-disable no-undef */ | ||
| const portMap = require('../port-map.json'); | ||
| const twitchProxyPort = portMap['twitch-proxy']; | ||
| const { baseUrl } = require('./jest-utils.js'); | ||
|
|
||
| const BASE_URL = baseUrl(twitchProxyPort); | ||
|
|
||
| describe('kraken api', () => { | ||
| it('should return freecodecamp user data', async () => { | ||
| const response = await fetch( | ||
| new URL('/twitch-api/users/freecodecamp', BASE_URL) | ||
| ); | ||
| const user = await response.json(); | ||
| expect(response.status).toBe(200); | ||
| expect(user.name).toBe('freecodecamp'); | ||
| expect(user.display_name).toBe('FreeCodeCamp'); | ||
| }); | ||
|
|
||
| it('should return freecodecamp channel data', async () => { | ||
| const response = await fetch( | ||
| new URL('/twitch-api/channels/freecodecamp', BASE_URL) | ||
| ); | ||
| const channel = await response.json(); | ||
| expect(response.status).toBe(200); | ||
| expect(channel.name).toBe('freecodecamp'); | ||
| expect(channel.display_name).toBe('FreeCodeCamp'); | ||
| expect(channel.url).toBe('https://www.twitch.tv/freecodecamp'); | ||
| }); | ||
|
|
||
| it("should return esl_sc2's stream data", async () => { | ||
| const response = await fetch( | ||
| new URL('/twitch-api/streams/ESL_SC2', BASE_URL) | ||
| ); | ||
| const stream = (await response.json()).stream; | ||
| expect(response.status).toBe(200); | ||
| expect(stream._id).toBe(23366709968); | ||
| }); | ||
| }); | ||
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.