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

Part 4b skips change in code in beforeEach function. #3660

Open
fecfecfec opened this issue Jun 5, 2024 · 2 comments
Open

Part 4b skips change in code in beforeEach function. #3660

fecfecfec opened this issue Jun 5, 2024 · 2 comments

Comments

@fecfecfec
Copy link
Contributor

I reached the section 'Refactoring tests' and found that beforeEach is declared as:

beforeEach(async () => {
    await Note.deleteMany({})
    await Note.insertMany(helper.initialNotes)
  })

But in the last stage and last linked branch (Part 4-5) before that section, beforeEach was declared as:

beforeEach(async () => {
  await Note.deleteMany({})

  const noteObjects = helper.initialNotes
    .map(note => new Note(note))
  const promiseArray = noteObjects.map(note => note.save())
  await Promise.all(promiseArray)
})

I would suggest a change in the content in the section Optimizing the beforeEach function, but I don't know the explanation besides "this looks cleaner".

Both solution work (or at least the test are running fine).

@imlakshaychauhan
Copy link

Hi @fecfecfec,

Could I please be assigned to this issue? I noticed it hasn't been closed yet and I'd love to help resolve it.

Thank you!

@fecfecfec
Copy link
Contributor Author

Hi @imlakshaychauhan , I think @mluukkai has the permission to assign the issue.

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

No branches or pull requests

2 participants