Skip to content
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

Quality Assurance - Issue Tracker #53853

Open
limeiscool opened this issue Feb 24, 2024 · 5 comments · May be fixed by #54646
Open

Quality Assurance - Issue Tracker #53853

limeiscool opened this issue Feb 24, 2024 · 5 comments · May be fixed by #54646
Labels
help wanted Open for all. You do not need permission to work on these. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.

Comments

@limeiscool
Copy link

Describe the Issue

None of the GET request examples/Tests mention to be able to GET with _id param, However during one of the PUT request tests there is a GET request sent with an ID, i struggled to find this Bug in my code, i feel adding one extra Functional test for GET request specifically requiring to be able to GET by IDs, If using mongoDB like i was the ID needs the toString Method in order to be read as a string. i attached a screen shot shows the PUT test with the GET request at the bottom

Affected Page

https://www.freecodecamp.org/learn/quality-assurance/quality-assurance-projects/issue-tracker

Your code




Expected behavior

Either extra functional test requiring to be able to GET with an ID, or
Updated index.html with GET example that shows GET with an ID

Screenshots

image

System

  • Device: [Desktop]
  • OS: [Windows 11 WSL Ubuntu 22.04.3 LTS]
  • Browser: [Chrome]
  • Version: [122.0.6261.70 ]

Additional context

No response

@limeiscool limeiscool added scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc. labels Feb 24, 2024
@naomi-lgbt
Copy link
Member

This requirement would be covered by:

You can send a GET request to /api/issues/{projectname} and filter the request by also passing along any field and value as a URL query (ie. /api/issues/{project}?open=false). You can pass one or more field/value pairs at once.

I'd be fine adding another check inside that existing test to look at the ?id= param.

@naomi-lgbt naomi-lgbt added help wanted Open for all. You do not need permission to work on these. and removed status: waiting triage This issue needs help from moderators and users to reproduce and confirm its validity and fix. labels Apr 22, 2024
@limeiscool
Copy link
Author

i see now the "any field" and value, this was a lack of knowledge at the time, being able to get data by an "id" is imperative.

Id like to propose a solution to the test above,

  • change query of getMultiple to GET the post created by carol and assigned to eric, this keeps the get Multiple aspect but returns 1 doc instead.

  • use the _id of getMultiple[0] to GET getCopy and assert that _id of getMultiple[0] is equal to _id of getCopy

const getMultiple = await $.get(url + '? 
created_by=Carol&assigned_to=Eric');
    assert.isArray(getMultiple);
    assert.lengthOf(getMultiple, 1);

// could write copyId inline instead
const copyId = getMultiple[0]._id
const getCopy = await $.get(url + `?_id=${copyId}`);
    assert.isArray(getCopy);
    assert.lengthOf(getCopy, 1);
    assert.equal(getCopy[0]._id, copyId, 'filtering by _id should return the correct document')

@naomi-lgbt
Copy link
Member

I'm hesitant to rewrite the entire tests, when instead we could update the test I indicated to try a query by ID (which we know won't break existing projects because a later test relies on that functionality).

@limeiscool
Copy link
Author

Agreed my proposed solution would be for the existing GET test that you indicated, you could just drop in copyId and getById after existing getMultiple, this adds a query by ID. The current tests only query by created_by and assigned_to

const copyId = getMultiple[0]._id
const getById = await $.get(url + `?_id=${copyId}`);
    assert.isArray(getById);
    assert.lengthOf(getById, 1);
    assert.equal(getById[0]._id, copyId, 'should be able to query a document by _id')

image

@naomi-lgbt
Copy link
Member

Ah, I see. Yes, that would be a good approach.

I'll go ahead and open this one up.

@a2937 a2937 linked a pull request May 3, 2024 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Open for all. You do not need permission to work on these. scope: curriculum Lessons, Challenges, Projects and other Curricular Content in curriculum directory. type: bug Issues that need priority attention. Platform, Curriculum tests (if broken completely), etc.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants