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

added tests #286

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

added tests #286

wants to merge 1 commit into from

Conversation

helga16
Copy link

@helga16 helga16 commented Nov 5, 2024

No description provided.

Copy link

@mateacademy-ai-mentor mateacademy-ai-mentor left a comment

Choose a reason for hiding this comment

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

Great job on implementing the Cypress tests! 🎉 The code meets all the core requirements and functionalities. While there are some minor improvements suggested, such as removing unnecessary use of new Object() and optimizing parameter usage in the login command, these do not impact the overall functionality. Keep up the great work and consider these suggestions for future enhancements! 😊

✨ Please rate this review in the Platform's notification center. I will be grateful for your feedback! ✨

let user;
cy.task('db:clear');
cy.task('generateUser').then((generateUser) => {
user = new Object(generateUser);

Choose a reason for hiding this comment

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

The use of new Object(generateUser) is unnecessary. You can directly assign user = generateUser; since generateUser is already an object.


it('should be created using New Article form', () => {

cy.task('generateArticle').then((articleDataString) => {
const article = new Object(articleDataString);

Choose a reason for hiding this comment

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

The use of new Object(articleDataString) is unnecessary. You can directly assign const article = articleDataString; since articleDataString is already an object.

});

it('should be edited using Edit button', () => {

cy.task('generateArticle').then((articleDataString) => {
const article = new Object(articleDataString);

Choose a reason for hiding this comment

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

The use of new Object(articleDataString) is unnecessary. You can directly assign const article = articleDataString; since articleDataString is already an object.

});
articlePage.editArticle();
cy.task('generateArticle').then((articleDataString) => {
const articleUpdated = new Object(articleDataString);

Choose a reason for hiding this comment

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

The use of new Object(articleDataString) is unnecessary. You can directly assign const articleUpdated = articleDataString; since articleDataString is already an object.

});

it('should be deleted using Delete button', () => {

cy.task('generateArticle').then((articleDataString) => {
const article = new Object(articleDataString);

Choose a reason for hiding this comment

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

The use of new Object(articleDataString) is unnecessary. You can directly assign const article = articleDataString; since articleDataString is already an object.


cy.task('db:clear');
cy.task('generateUser').then((generateUser) => {
user = new Object(generateUser);

Choose a reason for hiding this comment

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

The use of new Object(generateUser) is unnecessary. You can directly assign user = generateUser; since generateUser is already an object.

let user;
cy.task('db:clear');
cy.task('generateUser').then((generateUser) => {
user = new Object(generateUser);

Choose a reason for hiding this comment

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

The use of new Object(generateUser) is unnecessary. You can directly assign user = generateUser; since generateUser is already an object.

let user;
cy.task('db:clear');
cy.task('generateUser').then((generateUser) => {
user = new Object(generateUser);

Choose a reason for hiding this comment

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

The use of new Object(generateUser) is unnecessary. You can directly assign user = generateUser; since generateUser is already an object.

Comment on lines +47 to +66
Cypress.Commands.add('login', (email = '[email protected]', username = 'riot', password = '12345Qwert!') => {
cy.request('POST', '/users', {
user: {
email,
username,
password
}
}).then(response => {
const user = {
bio: response.body.user.bio,
effectiveImage: "https://static.productionready.io/images/smiley-cyrus.jpg",
email: response.body.user.email,
image: response.body.user.image,
token: response.body.user.token,
username: response.body.user.username,
};
window.localStorage.setItem('user', JSON.stringify(user));
cy.setCookie('auth', response.body.user.token);
});
});

Choose a reason for hiding this comment

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

In the login command, the username parameter is not used in the request body. Consider removing it from the parameters if it's not needed for the login process.

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.

2 participants