Skip to content

Correct way to test client code #2

Description

@james-m-henderson

What is the "right" way to add client code tests?

I tried the obvious:

require(TEST_HELPER) // <--- This must be at the top of every test file

var request = require('supertest-as-promised')
var app = require(__client + '/app.js')
...

But it fails since the window is not defined. Simply setting window = global doesn't work either since then "document" can't be found.

I guess the next step would be to use m.deps() and set mock objects for the window and document, but I'm wondering if I'm missing anything, or if it would make sense to integrate this stuff into the boilerplate.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions