0

I have got a small backend server in nodejs which is using socket.io to connect with client and on the other side is uses google api to delivery data.

Is there a good way to write tests and still use something like Travis CI?

In a local enviroment there is no problem with doing test with a fake user.

2 Answers 2

0

Yes, you have a couple options.

  • Write unit style tests against your JavaScript frontend with something like Karma or Yeti, both of which support Travis CI. This would involve mocking out the socket.io API in your frontend code with something like Sinon.
  • Borrow some concepts from Laika which uses PhantomJS to execute browser code against your app running in its own process. Laika is for testing client/server interactions similar to what you're doing.

In either case you probably want to mock out the google API while testing using Sinon or Nock.

Sign up to request clarification or add additional context in comments.

Comments

0

Just answered a question using nock but was too sleepy to care to check the old date. =/

See if this answer can help you in any way about HTTP mocking with nock:

Simulate HTTP responses to test a node.js HTTP client

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.