vows

Node.js testing RESTful API (vows.js?)

时光总嘲笑我的痴心妄想 提交于 2019-12-21 04:14:05
问题 I could really do with some advice on testing a RESTful api I created in node.js. There are a plethora of frameworks out there and I am at a loss. My testing knowledge isn't good enough generally which is why I am trying to write these tests. I've tried vows.js which seems nice but I couldn't work out how to incorporate the testing of my API, I need some sort of client. An example of a simple post to test a login system is all I need to get going. 回答1: Update 6 months later vows-is sucks. use

How do you mock MySQL (without an ORM) in Node.js?

核能气质少年 提交于 2019-12-17 09:09:32
问题 I'm using Node.js with felixge's node-mysql client. I am not using an ORM. I'm testing with Vows and want to be able to mock my database, possibly using Sinon. Since I don't really have a DAL per se (aside from node-mysql ), I'm not really sure how to go about this. My models are mostly simple CRUD with a lot of getters. Any ideas on how to accomplish this? 回答1: With sinon, you can put a mock or stub around an entire module. For example, suppose the mysql module has a function query : var

How do you mock MySQL (without an ORM) in Node.js?

♀尐吖头ヾ 提交于 2019-12-17 09:09:21
问题 I'm using Node.js with felixge's node-mysql client. I am not using an ORM. I'm testing with Vows and want to be able to mock my database, possibly using Sinon. Since I don't really have a DAL per se (aside from node-mysql ), I'm not really sure how to go about this. My models are mostly simple CRUD with a lot of getters. Any ideas on how to accomplish this? 回答1: With sinon, you can put a mock or stub around an entire module. For example, suppose the mysql module has a function query : var

Async testing with vows using the http.get library in Node.js

喜欢而已 提交于 2019-12-01 06:22:18
问题 I'm having a doozie of a time trying to get a basic http test to work with vows. I think I've followed the async example from vows http://vowsjs.org/#-writing-asynchronous-tests and substitued the appropriate calls, but I must be missing something. The test code looks like this: var http = require('http'), vows = require('vows'), assert = require('assert'); vows.describe("homepage").addBatch({ "Get the home page": { topic: function() { http.get({'host': "127.0.0.1", 'port': 5000, 'path': '/'}

Command not found after npm install in zsh

不羁的心 提交于 2019-11-28 15:45:40
问题 I'm having some problems installing vows via npm in zsh. Here's what I get. I tried installing it with and without the -g option. Do you have any idea what's wrong here? [❤ ~/Desktop/sauce-node-demo:master] npm install -g vows npm http GET https://registry.npmjs.org/vows npm http 304 https://registry.npmjs.org/vows npm http GET https://registry.npmjs.org/eyes npm http GET https://registry.npmjs.org/diff npm http 304 https://registry.npmjs.org/eyes npm http 304 https://registry.npmjs.org/diff

How do you mock MySQL (without an ORM) in Node.js?

匆匆过客 提交于 2019-11-27 11:54:06
I'm using Node.js with felixge's node-mysql client. I am not using an ORM. I'm testing with Vows and want to be able to mock my database, possibly using Sinon. Since I don't really have a DAL per se (aside from node-mysql ), I'm not really sure how to go about this. My models are mostly simple CRUD with a lot of getters. Any ideas on how to accomplish this? With sinon, you can put a mock or stub around an entire module. For example, suppose the mysql module has a function query : var mock; mock = sinon.mock(require('mysql')) mock.expects('query').with(queryString, queryParams).yields(null,