@@ -3,6 +3,7 @@ require('../../support/spec_helper');
3
3
4
4
describe ( "Cucumber.Listener.JsonFormatter" , function ( ) {
5
5
var Cucumber = requireLib ( 'cucumber' ) ;
6
+ var fs = require ( 'fs' ) ;
6
7
var jsonFormatter , options ;
7
8
8
9
beforeEach ( function ( ) {
@@ -244,7 +245,13 @@ describe("Cucumber.Listener.JsonFormatter", function () {
244
245
beforeEach ( function ( ) {
245
246
var attachment1 = createSpyWithStubs ( "first attachment" , { getMimeType : "first mime type" , getData : "first data" } ) ;
246
247
var attachment2 = createSpyWithStubs ( "second attachment" , { getMimeType : "second mime type" , getData : "second data" } ) ;
247
- var attachments = [ attachment1 , attachment2 ] ;
248
+ var favicon = fs . readFileSync ( 'example/images/favicon.png' ) ;
249
+ var attachment3 = createSpyWithStubs ( "third attachment" , {
250
+ getMimeType : "image/png" ,
251
+ getData : favicon
252
+ } ) ;
253
+ this . faviconBase64 = favicon . toString ( 'base64' ) ;
254
+ var attachments = [ attachment1 , attachment2 , attachment3 ] ;
248
255
stepResult . hasAttachments . and . returnValue ( true ) ;
249
256
stepResult . getAttachments . and . returnValue ( attachments ) ;
250
257
jsonFormatter . handleStepResultEvent ( stepResult ) ;
@@ -257,7 +264,11 @@ describe("Cucumber.Listener.JsonFormatter", function () {
257
264
var features = JSON . parse ( json ) ;
258
265
expect ( features [ 0 ] . elements [ 0 ] . steps [ 0 ] . embeddings ) . toEqual ( [
259
266
{ data : 'Zmlyc3QgZGF0YQ==' , mime_type : 'first mime type' } ,
260
- { data : 'c2Vjb25kIGRhdGE=' , mime_type : 'second mime type' }
267
+ { data : 'c2Vjb25kIGRhdGE=' , mime_type : 'second mime type' } ,
268
+ {
269
+ data : this . faviconBase64 ,
270
+ mime_type : 'image/png'
271
+ }
261
272
] ) ;
262
273
} ) ;
263
274
} ) ;
0 commit comments