Skip to content

Conversation

@esezen
Copy link
Contributor

@esezen esezen commented Mar 27, 2023

No description provided.

@esezen esezen requested a review from a team March 27, 2023 13:29
Copy link
Contributor

@mocca102 mocca102 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Main functionality is working great. Thank you for adding this and giving great attention to types. Just added some comments. let me know what you think

expect(res).to.have.property('quiz_id').to.be.an('string');
expect(fetchSpy).to.have.been.called;
expect(requestedUrlParams).to.have.property('section').to.equal(section);
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is section relevant to quizzes. I thought it's not

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also news to me but yes different sections can have different Quizzes

expect(res.response).to.have.property('results').to.be.an('array');
expect(requestedUrlParams).to.have.property('key');
expect(requestedUrlParams).to.have.property('i');
expect(requestedUrlParams).to.have.property('s');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we also add an expect statement to check for quiz_session_id?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also as I remember that if we provide the quiz_session_id as a parameter it should be returned in the response. If what I'm remembering is correct can we add a test case for this as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be handled here #245

});
});

it('Should return a result given valid API key, answers, and resultsPerPage parameters', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you meant and "filters" here instead of "resultsPerPage"

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! Thank you

}

export interface QuizzesResultsParameters extends QuizzesParameters {
answers: any[];
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

answers already part of QuizzesParameters did you intend to have it here also

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They are optional there but required here. Is this the right way to do it?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks right to me didn't notice that it's required here

* @param {string} [parameters.versionId] - Specific version identifier for the quiz
* @param {number} [parameters.page] - The page number of the results
* @param {number} [parameters.resultsPerPage] - The number of results per page to return
* @param {object} [parameters.filters] - Key / value mapping (dictionary) of filters used to refine results
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we're missing the quiz_session_id as a parameter

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handled here #245


if (parameters) {
const { section, answers, versionId } = parameters;
const { section, answers, versionId, page, resultsPerPage, filters } = parameters;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

reminder to destruct quiz_session_id here as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handled here #245

@esezen esezen requested a review from mocca102 March 30, 2023 13:17
Copy link
Contributor

@mocca102 mocca102 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

Copy link
Contributor

@jjl014 jjl014 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! 🚀

@esezen esezen merged commit 0f2cd02 into master Apr 3, 2023
@esezen esezen deleted the csl-2208-js-client-sdk-migrate-quizzes-finalize branch April 3, 2023 20:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants