Skip to content

Test Results - Connor OBrien #23

Description

@connorpobrien

Test Case 1: A group is instantiated and a new member joins

  • Assume three users already exist within the system
  • These members form a new group using POST api/groups

Curl request

curl -X POST 'http://127.0.0.1:3000/api/groups/register' \
-H 'Content-Type: application/json' \
-d '{
    "userId": "1",
    "name": "Weekend Getaway"
}'

Response

{
    "group_id": 7
}
  • The details of the group are verified using GET api/groups/{group_id}

Curl request

curl -X GET 'http://127.0.0.1:3000/api/groups/7' \
-H 'Content-Type: application/json'

Response

{
    "group_id": 7,
    "group_name": "Weekend Getaway",
    "members": [1, 2, 3]
}
  • One more user joins the group using POST /api/groups/{group_id}/join

Curl request

curl -X POST 'http://127.0.0.1:3000/api/groups/7/join' \
-H 'Content-Type: application/json' \
-d '{"user_id": 4}'

Response

{
    "message": "User joined the group successfully."
}

Test Case 2: An existing groups adds and verifies transactions

  • A group of three already exists with a group ID of 5
  • An expense is added using POST /api/groups/{group_id}/expenses

Curl request

curl -X POST 'http://127.0.0.1:3000/api/groups/5/expenses' \
-H 'Content-Type: application/json' \
-d '{
    "amount": 150.00,
    "description": "Camping Gear",
    "date": "2023-10-25"
}'

Response

{
    "message": "Expense added successfully.",
    "expense_id": 20
}
  • Another expense is added using POST /api/groups/{group_id}/expenses

Curl request

curl -X POST 'http://127.0.0.1:3000/api/groups/5/expenses' \
-H 'Content-Type: application/json' \
-d '{
    "amount": 60.00,
    "description": "Food Supplies",
    "date": "2023-10-25"
}'

Response

{
    "message": "Expense added successfully.",
    "expense_id": 21
}
  • The details of the first expense are retrieved using GET /api/groups/{group_id}/expenses/{expense_id}

Curl request

curl -X GET 'http://127.0.0.1:3000/api/groups/5/expenses/20' \
-H 'Content-Type: application/json'

Response

{
    "expense_id": 20,
    "amount": 150.00,
    "description": "Camping Gear",
    "date": "2023-10-25"
}
  • List of expenses is generated using GET /api/groups/{group_id}/expenses

Curl request

curl -X GET 'http://127.0.0.1:3000/api/groups/5/expenses' \
-H 'Content-Type: application/json'

Response

{
    "expenses": [
        {
            "expense_id": 20,
            "amount": 150.00,
            "description": "Camping Gear",
            "date": "2023-10-25"
        },
        {
            "expense_id": 21,
            "amount": 60.00,
            "description": "Food Supplies",
            "date": "2023-10-25"
        }
    ]
}

Test Case 3: An existing group updates transactions and calculates amount owed

  • A group of three already exists with a group ID of 6. This group has existing transactions.
  • Update an existing transaction with expense_ID of 15 using PUT /api/groups/{group_id}/expenses/{expense_id}

Curl request

curl -X PUT 'http://127.0.0.1:3000/api/groups/6/expenses/15' \
-H 'Content-Type: application/json' \
-d '{
    "amount": 175.00,
    "description": "Updated Camping Gear Expense"
}'

Response

{
    "message": "Expense details updated successfully."
}
  • Delete an expense using DELETE /api/groups/{group_id}/expenses/{expense_id}

Curl request

curl -X DELETE 'http://127.0.0.1:3000/api/groups/6/expenses/16' \
-H 'Content-Type: application/json'

Response

{
    "message": "Expense deleted successfully."
}
  • Retrieve calculation of amount owed using GET /api/groups/{group_id}/calculate

Curl request

curl -X GET 'http://127.0.0.1:3000/api/groups/6/calculate' \
-H 'Content-Type: application/json'

Response

{
    "balances": {
        "user1": 58.33,
        "user2": -29.17,
        "user3": -29.17
    }
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions