@@ -229,6 +229,7 @@ describe('PercyClient', () => {
229229 'parallel-total-shards' : client . env . parallel . total ,
230230 'cli-start-time' : null ,
231231 'testhub-build-uuid' : client . env . testhubBuildUuid ,
232+ 'testhub-build-run-id' : client . env . testhubBuildRunId ,
232233 source : 'user_created' ,
233234 partial : client . env . partial ,
234235 tags : [ ]
@@ -266,6 +267,7 @@ describe('PercyClient', () => {
266267 'parallel-total-shards' : client . env . parallel . total ,
267268 'cli-start-time' : null ,
268269 'testhub-build-uuid' : client . env . testhubBuildUuid ,
270+ 'testhub-build-run-id' : client . env . testhubBuildRunId ,
269271 source : 'user_created' ,
270272 partial : client . env . partial ,
271273 tags : [ ]
@@ -350,6 +352,7 @@ describe('PercyClient', () => {
350352 'parallel-total-shards' : client . env . parallel . total ,
351353 'cli-start-time' : null ,
352354 'testhub-build-uuid' : client . env . testhubBuildUuid ,
355+ 'testhub-build-run-id' : client . env . testhubBuildRunId ,
353356 source : 'user_created' ,
354357 partial : client . env . partial ,
355358 tags : [ ]
@@ -391,6 +394,7 @@ describe('PercyClient', () => {
391394 'parallel-total-shards' : client . env . parallel . total ,
392395 'cli-start-time' : null ,
393396 'testhub-build-uuid' : client . env . testhubBuildUuid ,
397+ 'testhub-build-run-id' : client . env . testhubBuildRunId ,
394398 source : 'user_created' ,
395399 partial : client . env . partial ,
396400 tags : [ { id : null , name : 'tag1' } , { id : null , name : 'tag2' } ]
@@ -433,6 +437,7 @@ describe('PercyClient', () => {
433437 'parallel-total-shards' : client . env . parallel . total ,
434438 'cli-start-time' : cliStartTime ,
435439 'testhub-build-uuid' : client . env . testhubBuildUuid ,
440+ 'testhub-build-run-id' : client . env . testhubBuildRunId ,
436441 source : 'auto_enabled_group' ,
437442 partial : client . env . partial ,
438443 tags : [ { id : null , name : 'tag1' } , { id : null , name : 'tag2' } ]
@@ -474,6 +479,7 @@ describe('PercyClient', () => {
474479 'parallel-total-shards' : client . env . parallel . total ,
475480 'cli-start-time' : null ,
476481 'testhub-build-uuid' : client . env . testhubBuildUuid ,
482+ 'testhub-build-run-id' : client . env . testhubBuildRunId ,
477483 source : 'user_created' ,
478484 partial : client . env . partial ,
479485 'skip-base-build' : true ,
@@ -513,6 +519,46 @@ describe('PercyClient', () => {
513519 'parallel-total-shards' : client . env . parallel . total ,
514520 'cli-start-time' : null ,
515521 'testhub-build-uuid' : 'test-uuid-123' ,
522+ 'testhub-build-run-id' : client . env . testhubBuildRunId ,
523+ source : 'user_created' ,
524+ partial : client . env . partial ,
525+ tags : [ ]
526+ }
527+ } ) ) ;
528+ } ) ;
529+
530+ it ( 'creates a new build with testhub-build-run-id' , async ( ) => {
531+ process . env . TH_BUILD_RUN_ID = 'test-run-id-123' ;
532+ await expectAsync ( client . createBuild ( { projectType : 'web' } ) ) . toBeResolvedTo ( {
533+ data : {
534+ id : '123' ,
535+ attributes : {
536+ 'build-number' : 1 ,
537+ 'web-url' : 'https://percy.io/test/test/123'
538+ }
539+ }
540+ } ) ;
541+
542+ expect ( api . requests [ '/builds' ] [ 0 ] . body . data )
543+ . toEqual ( jasmine . objectContaining ( {
544+ attributes : {
545+ branch : client . env . git . branch ,
546+ type : 'web' ,
547+ 'target-branch' : client . env . target . branch ,
548+ 'target-commit-sha' : client . env . target . commit ,
549+ 'commit-sha' : client . env . git . sha ,
550+ 'commit-committed-at' : client . env . git . committedAt ,
551+ 'commit-author-name' : client . env . git . authorName ,
552+ 'commit-author-email' : client . env . git . authorEmail ,
553+ 'commit-committer-name' : client . env . git . committerName ,
554+ 'commit-committer-email' : client . env . git . committerEmail ,
555+ 'commit-message' : client . env . git . message ,
556+ 'pull-request-number' : client . env . pullRequest ,
557+ 'parallel-nonce' : client . env . parallel . nonce ,
558+ 'parallel-total-shards' : client . env . parallel . total ,
559+ 'cli-start-time' : null ,
560+ 'testhub-build-uuid' : client . env . testhubBuildUuid ,
561+ 'testhub-build-run-id' : 'test-run-id-123' ,
516562 source : 'user_created' ,
517563 partial : client . env . partial ,
518564 tags : [ ]
@@ -551,6 +597,7 @@ describe('PercyClient', () => {
551597 'parallel-total-shards' : client . env . parallel . total ,
552598 'cli-start-time' : null ,
553599 'testhub-build-uuid' : client . env . testhubBuildUuid ,
600+ 'testhub-build-run-id' : client . env . testhubBuildRunId ,
554601 source : 'bstack_sdk_created' ,
555602 partial : client . env . partial ,
556603 tags : [ ]
0 commit comments