DEV Community

Discussion on: Can you help me review my MEN stack app?

Collapse
 
alexanderjanke profile image
Alex Janke

When adding eslint into your project you ensure that everyone uses the same settings. If you change your VsCode-settings and I want to collaborate to your repo - how do I get your lint-settings? ;)

Okay for unit tests it's pretty simple. You write code that tests your code. Imagine you have a function that adds two values

function add(first, second) {
  return first + second;
}

To test your function with ava you could then say something like

/*
  you define what the result of your function SHOULD be.
  If your implementation of the add function was broken, 
  this would return an error telling you exactly what is wrong.
  */
test("add function returns 3", t => {
  t.is(add(1, 2), 3); // <-- this passes because 1+2 does indeed equal 3.
  // The line can be read as "Please ensure that the result of add(1, 2) equals 3"
});

I hope it makes sense!

Cypress is purely for UI to help you simulate user inputs. You could write cypress-tests that click a textbox, enter a specific text and hit your sign-in button. All automated.

Thread Thread
 
kretaceous profile image
Abhijit Hota

Thanks a lot for explaining the concepts!
I'll definitely try to implement them.