Posts tagged "testing"

Found 11 posts tagged testing

How to test a function that works with time

Published on
#javascript #nodejs #testing 

While building Minimal Analytics I had the need to test a function that was dependent on time.

In my case, the function returned the milliseconds until midnight.

Here is a simple way to test the function msUntilMidnight.


Read more

Test driving a HackerNews scraper with Node.js

Published on
#tdd #nodejs #testing #cleancode #refactoring #javascript 

This is a short summary of my experience while writing a simple HackerNews scraper.

As a pure exercise or kata if you want, I tried to apply Clean code, Refactoring and Testing priciples for this small npm module.

The task is simple:

Get the posts on the front page of https://news.ycombinator.com and parse them.


Read more

Validate your RSS feed

Published on
#rss #testing #CI #blogging 

Today a dear user made me aware that my RSS feed broke. There was a XML Parsing Error for cri.dev/rss.xml.

ASAP after work I checked the validity through validator.w3.org/feed/ and in fact there were some issues with it.


Read more

devblog: yet another static site generator, seriously

devblog is yet another lightweight static site generator.

Although there are widely used SSG like 11ty (which this blog was previously based on), Jekyll (also previously used), GatsbyJS and many others, I wanted to get my hands dirty and understand how to make the process of building a static blog even simpler, if possible.

Even simpler in the sense of "it does just what I need and nothing more".

Install via npm i -g devblog or create a blog with a one-liner npx devblog init my-new-blog, cd my-new-blog and serve with npx http-server _site 8080. It's that easy.

Rebuild the blog by running npx devblog (or npm i -g devblog and then just run devblog in the main directory)

Continue reading my story of building devblog.


Read more

Always $digest after you expect

Published on
#angularjs #testing 

Angular`s digest loop is like a baby: you need to take care of it and feed it well, or it will puke all over your nice shirt. Actually, it will probably, eventually do it anyway.


Read more