@@ -332,7 +332,9 @@ describe('index', function () {
332332 'x-request-uuid' : '1e8d4e8e-5fcf-4624-b091-b10bd6ecaf5e'
333333 } ;
334334
335- return scm . parseHook ( headers , testPayloadOpen ) . then ( result => assert . deepEqual ( result , expected ) ) ;
335+ return scm
336+ . parseHook ( headers , JSON . stringify ( testPayloadOpen ) )
337+ . then ( result => assert . deepEqual ( result , expected ) ) ;
336338 } ) ;
337339
338340 it ( 'resolves the correct parsed config for sync PR (ammending commit)' , ( ) => {
@@ -354,7 +356,9 @@ describe('index', function () {
354356 'x-request-uuid' : '1e8d4e8e-5fcf-4624-b091-b10bd6ecaf5e'
355357 } ;
356358
357- return scm . parseHook ( headers , testPayloadSync ) . then ( result => assert . deepEqual ( result , expected ) ) ;
359+ return scm
360+ . parseHook ( headers , JSON . stringify ( testPayloadSync ) )
361+ . then ( result => assert . deepEqual ( result , expected ) ) ;
358362 } ) ;
359363
360364 it ( 'resolves the correct parsed config for closed PR after merged' , ( ) => {
@@ -376,7 +380,9 @@ describe('index', function () {
376380 'x-request-uuid' : '1e8d4e8e-5fcf-4624-b091-b10bd6ecaf5e'
377381 } ;
378382
379- return scm . parseHook ( headers , testPayloadClose ) . then ( result => assert . deepEqual ( result , expected ) ) ;
383+ return scm
384+ . parseHook ( headers , JSON . stringify ( testPayloadClose ) )
385+ . then ( result => assert . deepEqual ( result , expected ) ) ;
380386 } ) ;
381387
382388 it ( 'resolves the correct parsed config for closed PR after declined' , ( ) => {
@@ -398,7 +404,9 @@ describe('index', function () {
398404 'x-request-uuid' : '1e8d4e8e-5fcf-4624-b091-b10bd6ecaf5e'
399405 } ;
400406
401- return scm . parseHook ( headers , testPayloadClose ) . then ( result => assert . deepEqual ( result , expected ) ) ;
407+ return scm
408+ . parseHook ( headers , JSON . stringify ( testPayloadClose ) )
409+ . then ( result => assert . deepEqual ( result , expected ) ) ;
402410 } ) ;
403411
404412 it ( 'resolves the correct parsed config for push to repo event' , ( ) => {
@@ -418,31 +426,39 @@ describe('index', function () {
418426 'x-request-uuid' : '1e8d4e8e-5fcf-4624-b091-b10bd6ecaf5e'
419427 } ;
420428
421- return scm . parseHook ( headers , testPayloadPush ) . then ( result => assert . deepEqual ( result , expected ) ) ;
429+ return scm
430+ . parseHook ( headers , JSON . stringify ( testPayloadPush ) )
431+ . then ( result => assert . deepEqual ( result , expected ) ) ;
422432 } ) ;
423433
424434 it ( 'resolves null if events are not supported: repoFork' , ( ) => {
425435 const repoFork = {
426436 'x-event-key' : 'repo:fork'
427437 } ;
428438
429- return scm . parseHook ( repoFork , testPayloadFork ) . then ( result => assert . deepEqual ( result , null ) ) ;
439+ return scm
440+ . parseHook ( repoFork , JSON . stringify ( testPayloadFork ) )
441+ . then ( result => assert . deepEqual ( result , null ) ) ;
430442 } ) ;
431443
432444 it ( 'resolves null if events are not supported: prComment' , ( ) => {
433445 const prComment = {
434446 'x-event-key' : 'pullrequest:comment_created'
435447 } ;
436448
437- return scm . parseHook ( prComment , testPayloadPrCommentCreate ) . then ( result => assert . deepEqual ( result , null ) ) ;
449+ return scm
450+ . parseHook ( prComment , JSON . stringify ( testPayloadPrCommentCreate ) )
451+ . then ( result => assert . deepEqual ( result , null ) ) ;
438452 } ) ;
439453
440454 it ( 'resolves null if events are not supported: issueCreated' , ( ) => {
441455 const issueCreated = {
442456 'x-event-key' : 'issue:created'
443457 } ;
444458
445- return scm . parseHook ( issueCreated , testPayloadIssueCreate ) . then ( result => assert . deepEqual ( result , null ) ) ;
459+ return scm
460+ . parseHook ( issueCreated , JSON . stringify ( testPayloadIssueCreate ) )
461+ . then ( result => assert . deepEqual ( result , null ) ) ;
446462 } ) ;
447463 } ) ;
448464
@@ -1861,47 +1877,47 @@ describe('index', function () {
18611877 it ( 'returns a true for a opened PR.' , ( ) => {
18621878 headers [ 'x-event-key' ] = 'pullrequest:created' ;
18631879
1864- return scm . canHandleWebhook ( headers , testPayloadOpen ) . then ( result => {
1880+ return scm . canHandleWebhook ( headers , JSON . stringify ( testPayloadOpen ) ) . then ( result => {
18651881 assert . strictEqual ( result , true ) ;
18661882 } ) ;
18671883 } ) ;
18681884
18691885 it ( 'returns a true for a sync PR (ammending commit).' , ( ) => {
18701886 headers [ 'x-event-key' ] = 'pullrequest:updated' ;
18711887
1872- return scm . canHandleWebhook ( headers , testPayloadSync ) . then ( result => {
1888+ return scm . canHandleWebhook ( headers , JSON . stringify ( testPayloadSync ) ) . then ( result => {
18731889 assert . isTrue ( result ) ;
18741890 } ) ;
18751891 } ) ;
18761892
18771893 it ( 'returns a true for closed PR after merged.' , ( ) => {
18781894 headers [ 'x-event-key' ] = 'pullrequest:fullfilled' ;
18791895
1880- return scm . canHandleWebhook ( headers , testPayloadClose ) . then ( result => {
1896+ return scm . canHandleWebhook ( headers , JSON . stringify ( testPayloadClose ) ) . then ( result => {
18811897 assert . isTrue ( result ) ;
18821898 } ) ;
18831899 } ) ;
18841900
18851901 it ( 'returns a true for closed PR after declined.' , ( ) => {
18861902 headers [ 'x-event-key' ] = 'pullrequest:rejected' ;
18871903
1888- return scm . canHandleWebhook ( headers , testPayloadClose ) . then ( result => {
1904+ return scm . canHandleWebhook ( headers , JSON . stringify ( testPayloadClose ) ) . then ( result => {
18891905 assert . isTrue ( result ) ;
18901906 } ) ;
18911907 } ) ;
18921908
18931909 it ( 'returns a true for a push event payload.' , ( ) => {
18941910 headers [ 'x-event-key' ] = 'repo:push' ;
18951911
1896- return scm . canHandleWebhook ( headers , testPayloadPush ) . then ( result => {
1912+ return scm . canHandleWebhook ( headers , JSON . stringify ( testPayloadPush ) ) . then ( result => {
18971913 assert . isTrue ( result ) ;
18981914 } ) ;
18991915 } ) ;
19001916
19011917 it ( 'returns a true when _parseHook() returns null.' , ( ) => {
19021918 headers [ 'x-event-key' ] = 'issue:created' ;
19031919
1904- return scm . canHandleWebhook ( headers , testPayloadPush ) . then ( result => {
1920+ return scm . canHandleWebhook ( headers , JSON . stringify ( testPayloadPush ) ) . then ( result => {
19051921 assert . isTrue ( result ) ;
19061922 } ) ;
19071923 } ) ;
@@ -1910,7 +1926,7 @@ describe('index', function () {
19101926 // eslint-disable-next-line no-underscore-dangle
19111927 scm . _parseHook = ( ) => Promise . reject ( new Error ( 'Test error' ) ) ;
19121928
1913- return scm . canHandleWebhook ( headers , testPayloadPush ) . then ( result => {
1929+ return scm . canHandleWebhook ( headers , JSON . stringify ( testPayloadPush ) ) . then ( result => {
19141930 assert . strictEqual ( result , false ) ;
19151931 } ) ;
19161932 } ) ;
@@ -1919,7 +1935,7 @@ describe('index', function () {
19191935 headers [ 'x-event-key' ] = 'repo:push' ;
19201936 testPayloadPush . repository . links . html . href = 'https://github.com/batman/test' ;
19211937
1922- return scm . canHandleWebhook ( headers , testPayloadPush ) . then ( result => {
1938+ return scm . canHandleWebhook ( headers , JSON . stringify ( testPayloadPush ) ) . then ( result => {
19231939 assert . isFalse ( result ) ;
19241940 } ) ;
19251941 } ) ;
0 commit comments