Skip to content

Instantly share code, notes, and snippets.

View benmkramer's full-sized avatar
🤖

Ben Kramer benmkramer

🤖
  • Monterey AI
  • California
  • 11:39 (UTC -08:00)
  • X @benmkramer
View GitHub Profile
var request = require('supertest');
var express = require('express');
var app = express();
app.get('/something', function (req, res) { res.send(200); });
it('should respond with 200', function (done) {
// PRODUCES DOUBLE CALLBACK
request(app)
.get('/something')
try {
var data = JSON.parse(b);
} catch (e) {}
if (data.type === 'SOMEERROR') {
res.cookie(...)
return res.redirect(...)
}
return next('api:error...')