@@ -2,6 +2,9 @@ const { expect } = require( "chai" );
22const request = require ( "supertest" ) ;
33const fs = require ( "fs" ) ;
44const _ = require ( "lodash" ) ;
5+ const jwt = require ( "jsonwebtoken" ) ;
6+ const nock = require ( "nock" ) ;
7+ const config = require ( "../../../config" ) ;
58
69const fixtures = JSON . parse ( fs . readFileSync ( "schema/fixtures.js" ) ) ;
710
@@ -64,6 +67,28 @@ describe( "Identifications", ( ) => {
6467 } ) ;
6568 } ) ;
6669
70+ describe ( "create" , ( ) => {
71+ it ( "sets `no_html` to true for all passthrough requests" , function ( done ) {
72+ const token = jwt . sign ( { user_id : 1 } ,
73+ config . jwtSecret || "secret" ,
74+ { algorithm : "HS512" } ) ;
75+ nock ( "http://localhost:3000" )
76+ . post ( "/identifications" , body => {
77+ expect ( body . no_html ) . to . eq ( true ) ;
78+ return body ;
79+ } )
80+ . reply ( 200 , [ ] ) ;
81+ request ( this . app ) . post ( "/v1/identifications" , {
82+ identification : {
83+ observation_id : 1
84+ }
85+ } )
86+ . set ( "Authorization" , token )
87+ . expect ( "Content-Type" , / j s o n / )
88+ . expect ( 200 , done ) ;
89+ } ) ;
90+ } ) ;
91+
6792 describe ( "details" , ( ) => {
6893 it ( "never returns email or IP for user in identification" , function ( done ) {
6994 request ( this . app ) . get ( "/v1/identifications/2023092501" )
0 commit comments