Getting better feedback from sinon stubs

DateReadtime 2 minutes Series Part 2 of Testing Express Tags

Sinon is an extremely powerful tools for writting unit tests. It helps to create standalone spies, stubs and mocks to isolate functionallity.

Setting up Sinon

The documentation suggests you can, for example, create a spy like so:

it('calls the original function', function () {
    var callback = sinon.spy();
    var proxy = once …
more ...

Extending Supertest

DateReadtime 3 minutes Series Part 1 of Testing Express Tags

I have an express app running behind an Apache reverse proxy with mod_auth_mellon used to authenticate users via SAML.

As a result of relying on headers for auth, I have lots of mocha tests that look like:

it("should add a comment with a user", (done) => {
    let expectedUser = "a User …
more ...

Forward and Back Buttons

DateTags

For what ever reason perhaps just nostalgia possibly because I happen to use them more than expected, I have forward and back links on my website. The buttons are JavaScript powered and I have had "noscript" tags warning users of their lack of functionality since I added the links years …

more ...

SOPA Blackout javascript "landing page"

DateReadtime 11 minutes Tags

Some code I modified from sopablackout.org to fit the needs of the Open Source Club. It temporarly blacks out the page until the user clicks. This however could be used for any type of important webpage announcement. You should probably talk to sopablackout.org for rights to this code …

more ...