-
Notifications
You must be signed in to change notification settings - Fork 1
Individual Contribution Section Can Uzduran
Name: Can Uzduran
Group: 5
Week 7 (13.04.23 - 19.04.23)
Description Type of Work Issue Attending Weekly Team Meeting #7 Discussion - Week 8 (20.04.23 - 26.04.23)
Week 9 (27.04.23 - 03.05.23)
Description Type of Work Issue Attending Weekly Team Meeting #8 Discussion - Week 10 (04.05.23 - 10.05.23)
Description Type of Work Issue Attending Weekly Team Meeting #9 Discussion - Implementing a Post Endpoint Feature #181 Implementing a Get Endpoint Feature #180 Creating the Schema of MongoDb HearthstoneCards Collection Feature #182 Creating CardByName Frontend Page Feature #276 Writing Unit Tests For CardByName Endpoints Test #278 Week 11 (11.05.23 - 17.05.23)
Description Type of Work Issue Attending Weekly Team Meeting #10 Discussion - Creating Individual Contribution Section for Milestone Report Documentation #330 Create A General Documentation Page for Practice App Documentation #333 Creating a Documentation Page for Card By Name API Documentation #308 Describe the Functionality of the Project Under Practice App Report Documentation #362
Rapid API the world's largest API hub, is used by over three million developers to find, test, and connect to thousands of APIs, all with a single API key and dashboard. There exist an API called Hearthstone API, which you can use for retrieving information such as information about cards, game, game servers, card sets and card qualities about well known digital collectible card game called Hearthstone. I will be using "Single Card" GET endpoint of Hearthstone API as my third party API.
Returns card by name. This may return more then one card if they share the same name.
route: https://omgvamp-hearthstone-v1.p.rapidapi.com/cards/%7Bname%7D
For the api documentation, you can check here.
Allows users to add cards of their choices from [Hearthstone Card List](https://hearthstone.blizzard.com/en-us/cards). Users can input the card name in the request body, and the endpoint will issue a request to url(https://omgvamp-hearthstone-v1.p.rapidapi.com/cards/%7Bname%7D) of the Hearthstone API to obtain the informations about the card(s) with the given name. The information about returned card is then parsed and inserted into our database (CardByName schema)
route: api/v1/games/card
Allows users to access a chronologically ordered list of the cards they have previously added into their collection. Accomplished by querying the database with the user's email address, which is provided in the request as a query parameter
route: api/v1/games/card
For a detailed documentation, visit this page.
For the unit tests JEST framework is used. Regarding the use of JEST framework for unit tests, it is worth noting that this approach allows for a more robust and comprehensive testing process. By implementing various tests, covering each possible scenario, we can ensure that the code is functioning as expected under different conditions and inputs.
These tests are responsible for ensuring that the API endpoint POST /api/v1/games/card works correctly when valid data is provided in the request body. It should return a HTTP status code of 201 stating some database objects are created and a success message if all necessary fields are provided.
- Case 1: When correct data is provided, it should return status code 201 and a success message
test("should respond with status code 201 and a success message in json with correct data ", async function () {
const response = await request(app).post(url).send(correctPostData);
expect(response.status).toEqual(201);
expect(response.headers["content-type"]).toMatch(/json/);
expect(response.body.status).toEqual("success");
expect(response.body.message).toEqual(
"Card info is inserted to database successfully"
);
});
- Case 2: When email field is missing, it should return status code 400 and an error message stating that all necessary fields should be provided.
test("should respond with status code 400 and a error message in json with missing email", async function () {
const response = await request(app).post(url).send(missingEmailData);
expect(response.status).toEqual(400);
expect(response.headers["content-type"]).toMatch(/json/);
expect(response.body.status).toEqual("Error");
expect(response.body.message).toEqual(
"You should provide all the necessary fields"
);
});
- Case 3: When card name field is missing, it should return status code 400 and an error message stating that all necessary fields should be provided.
test("should respond with status code 400 and a error message in json with missing card name", async function () {
const response = await request(app).post(url).send(missingCardNameData);
expect(response.status).toEqual(400);
expect(response.headers["content-type"]).toMatch(/json/);
expect(response.body.status).toEqual("Error");
expect(response.body.message).toEqual(
"You should provide all the necessary fields"
);
});
- Case 4: When invalid card name is provided, it should return status code 400 and an error message stating that no card found, please check the correct parameters.
test("should respond with status code 404 and a error message in json with invalid card name", async function () {
const response = await request(app).post(url).send(invalidCardName);
expect(response.status).toEqual(400);
expect(response.headers["content-type"]).toMatch(/json/);
expect(response.body.status).toEqual("Error");
expect(response.body.message).toEqual(
"An error occured!"
);
});
These test are responsible for ensuring that the API endpoint GET /api/v1/games/card works correctly when valid data is provided in the query parameter. It should return a HTTP status code of 200 and previously added cards from the database if a registered user's email address is provided. To be able to test the GET endpoint, first some seed data is created, upon completion of the tests this data is removed in order not to leave dirty data in the database.
- Case 1: When a registered user's email is provided, it should return status code 200 and previous responses that is made to /card endpoint that is associated with that user's email address.
test("should respond with status code 200 and a success message in json with correct data ", async function () {
const response = await request(app).get(registeredUserUrl);
expect(response.status).toEqual(200);
expect(response.headers["content-type"]).toMatch(/json/);
expect(response.body.length).toEqual(4);
expect(response.body[0].user_email).toBeDefined();
expect(response.body[0].card_id).toBeDefined();
expect(response.body[0].card_name).toBeDefined();
expect(response.body[0].card_set).toBeDefined();
});
- Case 2: When a non-registered user's email is provided, it should return an empty array.
test("should return an empty array with a non registered user email ", async function () {
const response = await request(app).get(nonRegisteredUserUrl);
expect(response.status).toEqual(200);
expect(response.headers["content-type"]).toMatch(/json/);
expect(response.body.length).toEqual(0);
});
Third Party Api Sample Call(GET https://omgvamp-hearthstone-v1.p.rapidapi.com/cards/Screaming%20Banshee)
[
{
"cardId": "ETC_522",
"dbfId": 90481,
"name": "Screaming Banshee",
"cardSet": "Festival of Legends",
"type": "Minion",
"rarity": "Epic",
"cost": 5,
"attack": 3,
"health": 6,
"text": "[x]<b>Lifesteal</b>\n_After your hero gains Health,_\nsummon a Soul with that\n_much Attack and Health.",
"flavor": "Her singing will be sure to wake you up (wake you up inside).",
"artist": "Konstantin Turovec",
"collectible": true,
"race": "Undead",
"playerClass": "Death Knight",
"runeCost": {
"blood": 1,
"frost": 0,
"unholy": 0
},
"img": "https://d15f34w2p8l1cc.cloudfront.net/hearthstone/cd7eb4b6358a310d129f2cac25c853ed394b11a2910b4534162b9eafa657ce03.png",
"locale": "enUS",
"mechanics": [
{
"name": "Lifesteal"
}
]
}
]
{
"card_name":"Screaming Banshee",
"userEmail":"[email protected]"
}
{
"status": "success",
"message": "Card info is inserted to database successfully"
}
Practice App Api Sample Get Call(GET /api/v1/games/card?userEmail=[email protected])
[
{
"card_id": "RLK_715",
"card_name": "Runeforging",
"card_set": "Core",
"user_email": "[email protected]",
"createdAt": "2023-05-12T13:40:38.323Z"
},
{
"card_id": "ETC_533",
"card_name": "Mosh Pit",
"card_set": "Festival of Legends",
"user_email": "[email protected]",
"createdAt": "2023-05-11T20:13:25.394Z"
},
{
"card_id": "RLK_Prologue_066",
"card_name": "Hematurge",
"card_set": "March of the Lich King",
"user_email": "[email protected]",
"createdAt": "2023-05-11T20:08:23.165Z"
},
{
"card_id": "ETC_522",
"card_name": "Screaming Banshee",
"card_set": "Festival of Legends",
"user_email": "[email protected]",
"createdAt": "2023-05-07T16:40:46.154Z"
},
{
"card_id": "RLK_225",
"card_name": "Blightfang",
"card_set": "March of the Lich King",
"user_email": "[email protected]",
"createdAt": "2023-05-07T16:38:30.265Z"
},
{
"card_id": "RLK_083",
"card_name": "Deathchiller",
"card_set": "Path of Arthas",
"user_email": "[email protected]",
"createdAt": "2023-05-07T12:02:45.979Z"
},
{
"card_id": "RLK_516",
"card_name": "Bone Breaker",
"card_set": "Path of Arthas",
"user_email": "[email protected]",
"createdAt": "2023-05-07T11:57:59.138Z"
}
]
Most of my challenges are about used technologies and git. Even though I've already had some hands on experience on web development and RESTful APIs, I needed to learn how to use NodeJS and Express Framework for practice app. To be honest, since I haven't written even a single Javascript line of code before in my life, it was kind of a demanding job for me. Yet, I can say that I did a pretty good job for implementing my side of the project and also for additional work. Secondly, using git intensively was also a demanding part of the project. Personally, I've used git for trivial usage such as committing and pushing, yet for this project since we are dealing with lots of independent development processes for each individual we needed to create many branches and used git intensively while managing these branches. Even though, using git was demanding, I can surely say that it was an informative learning experience for my side.
Cmpe 352
Cmpe 451
Cmpe 352
Milestone 1
Final Milestone
Milestone 1
Milestone 2
Final Milestone
- Authentication Mockup
- Forum Mockup
- Game Reviews Mockup
- Games Page Mockup
- Group Page Mockup
- Home Page Mockup
- Profile Page Mockup
- Unregistered User Scenario: Sign Up
- Unregistered User Scenario: Search for a Game and Browse the Game Forum
- Registered User Scenario: Create Post in a Game Forum
- Registered User Scenario: Search For Groups and Join A Group
📝 RAM
- Issue Template
- Personal Information Template
- Meeting Note Template
- Contributions Template
- API Documentation Template
API Documentation for Practice App
- Top Games
- Yugioh Card
- Hearthstone Card
- Games By User
- Game Reviews
- Games By Genre
- Games By Category
- Game Suggestions
- Esport Tournaments
- Achievement By Game Id
- Rock Paper Scissors
- Game By Deal