How web works ?

Jan 3, 2020

What happens when we enter a URL like https://en.wikipedia.org in a browser ?

DNS Lookup

The browser contacts a server on internet called a DNS server and asks it, “What is the IP of “en.wikipedia.org ?”. DNS server transforms domain names into IP address. For example DNS server response for this case could be “198.35.26.96”.

Connect to IP address and fetch the HTML page

The browser send an HTTP GET / HTTP request to the web server running on the computer at that address. HTTP is a protocol which allows the fetching of resources such as HTML documents. Its the foundation of data exchange on the web.

Render HTML web page

The browser takes the HTML response returned by the server and renders it as a web page. HTML is a martup language, it is the standard for creating web pages.

References

Categories : Web   HTTP

What are Curry functions in JavaScript

Jul 10, 2019

Currying is a technique of evaluating function with multiple arguments, into sequence of function with single argument. That is, when we turn a function call add(1,2,3) into add(1)(2)(3) .

References

  • https://codeburst.io/currying-in-javascript-ba51eb9778dc
Categories : JavaScript

Which one to choose Mocha or Jest

Jul 10, 2019

If you have a large project with the need for flexibility and customization then Mocha is probably the choice for you. If you have a smaller project and don’t need the extra setup and configuration up front, Jest is probably the better option.

References

  • https://blog.usejournal.com/jest-vs-mocha-whats-the-difference-235df75ffdf3
  • https://medium.com/airbnb-engineering/unlocking-test-performance-migrating-from-mocha-to-jest-2796c508ec50
Categories : JavaScript

What is the difference between Mocha and Chai JS

Jul 8, 2019

Mocha provides developers with a base test framework, allowing you to have options as to which assertion, moking and spy libraries you want to use. Chai is one of the popular open-source assertion libraries used with Mocha.

References

  • https://amzotti.github.io/testing/2015/03/16/what-is-the-difference-between-a-test-runner-testing-framework-assertion-library-and-a-testing-plugin/
  • https://blog.usejournal.com/jest-vs-mocha-whats-the-difference-235df75ffdf3
Categories : JavaScript

Can Jest be used for unit testing Backbone Application?

Jul 8, 2019

Yes!! We can unit test Backbone JS applications using Jest

References

  • https://github.com/captbaritone/tdd-jest-backbone
  • https://medium.com/@michaelsholty/using-jest-snapshots-in-a-marionette-application-even-with-handlebars-f5c152525006
Categories : JavaScript