@@ -18,7 +18,7 @@ const urls = {}
1818
1919const pactContributors = [
2020 {
21- name : "Red Hat" ,
21+ name : "Orange Hat" ,
2222 contributions : 68 ,
2323 contributors : 10
2424 } ,
@@ -54,7 +54,7 @@ const manyContributors = [
5454 contributors : 3
5555 } ,
5656 {
57- name : "Red Hat" ,
57+ name : "Orange Hat" ,
5858 contributions : 33 ,
5959 contributors : 5
6060 } ,
@@ -65,7 +65,7 @@ const manyContributors = [
6565urls [ "users/redhatofficial" ] = {
6666 login : "RedHatOfficial" ,
6767 type : "Organization" ,
68- name : "Red Hat" ,
68+ name : "Orange Hat" ,
6969 company : null ,
7070}
7171
@@ -79,7 +79,7 @@ const frogNode = {
7979 "author" : {
8080 "user" : {
8181 "login" : "someonewhoribbits" ,
82- "company" : "Red Hat"
82+ "company" : "Orange Hat"
8383 }
8484 }
8585 }
@@ -122,7 +122,7 @@ const frogNodeDifferentCompany = {
122122 "author" : {
123123 "user" : {
124124 "login" : "some-name" ,
125- "company" : "Red Hat @somewhere"
125+ "company" : "Orange Hat @somewhere"
126126 }
127127 }
128128 }
@@ -232,15 +232,15 @@ describe("the github sponsor finder", () => {
232232 it ( "returns a list of company sponsors, given an org and project" , async ( ) => {
233233 const sponsor = await findSponsor ( "someorg" , "someproject" )
234234 expect ( queryGraphQl ) . toHaveBeenCalled ( )
235- expect ( sponsor ) . toContain ( "Red Hat" )
235+ expect ( sponsor ) . toContain ( "Orange Hat" )
236236 } )
237237
238238 it ( "orders company sponsors by contribution level" , async ( ) => {
239239 setMinimumContributorCount ( 1 )
240240 setMinimumContributionPercent ( 1 )
241241 const sponsor = await findSponsor ( "someorg" , "someproject" )
242242 expect ( queryGraphQl ) . toHaveBeenCalled ( )
243- expect ( sponsor ) . toStrictEqual ( [ "Rabbit" , "Red Hat" , "Tortoise" ] )
243+ expect ( sponsor ) . toStrictEqual ( [ "Rabbit" , "Orange Hat" , "Tortoise" ] )
244244 } )
245245
246246 it ( "filters out companies which do not have enough contributors" , async ( ) => {
@@ -278,7 +278,7 @@ describe("the github sponsor finder", () => {
278278 companyWithASingleContributor ,
279279 "Occasional Company" ,
280280 "Another Company" ,
281- "Red Hat" ,
281+ "Orange Hat" ,
282282 ] )
283283 } )
284284
@@ -377,23 +377,31 @@ describe("the github sponsor finder", () => {
377377 } )
378378
379379 it ( "normalises a company name with Inc at the end" , async ( ) => {
380- const sponsor = await resolveAndNormalizeCompanyName ( "Red Hat, Inc" )
381- expect ( sponsor ) . toBe ( "Red Hat" )
380+ const sponsor = await resolveAndNormalizeCompanyName ( "Orange Hat, Inc" )
381+ expect ( sponsor ) . toBe ( "Orange Hat" )
382382 } )
383383
384384 it ( "normalises a company name with Inc. at the end" , async ( ) => {
385- const sponsor = await resolveAndNormalizeCompanyName ( "Red Hat, Inc." )
386- expect ( sponsor ) . toBe ( "Red Hat" )
385+ const sponsor = await resolveAndNormalizeCompanyName ( "Orange Hat, Inc." )
386+ expect ( sponsor ) . toBe ( "Orange Hat" )
387387 } )
388388
389389 it ( "normalises a company name with a 'by' structure at the end" , async ( ) => {
390390 const sponsor = await resolveAndNormalizeCompanyName ( "JBoss by Red Hat by IBM" )
391- expect ( sponsor ) . toBe ( "Red Hat" )
391+ expect ( sponsor ) . toBe ( "Red Hat & IBM" )
392+ } )
393+
394+ it ( "handles complex ownership relationships" , async ( ) => {
395+ let sponsor = await resolveAndNormalizeCompanyName ( "Red Hat, Inc" )
396+ expect ( sponsor ) . toBe ( "Red Hat & IBM" )
397+
398+ sponsor = await resolveAndNormalizeCompanyName ( "IBM" )
399+ expect ( sponsor ) . toBe ( "Red Hat & IBM" )
392400 } )
393401
394402 it ( "normalises a company name with an '@' structure at the end" , async ( ) => {
395- const sponsor = await resolveAndNormalizeCompanyName ( "Red Hat @kiegroup" )
396- expect ( sponsor ) . toBe ( "Red Hat" )
403+ const sponsor = await resolveAndNormalizeCompanyName ( "Orange Hat @kiegroup" )
404+ expect ( sponsor ) . toBe ( "Orange Hat" )
397405 } )
398406
399407 it ( "normalises a company name with a parenthetical structure at the end" , async ( ) => {
@@ -402,14 +410,14 @@ describe("the github sponsor finder", () => {
402410 } )
403411
404412 it ( "normalises a company name with a hyphenated '@' structure at the end" , async ( ) => {
405- const sponsor = await resolveAndNormalizeCompanyName ( "Red Hat - @hibernate" )
406- expect ( sponsor ) . toBe ( "Red Hat" )
413+ const sponsor = await resolveAndNormalizeCompanyName ( "Orange Hat - @hibernate" )
414+ expect ( sponsor ) . toBe ( "Orange Hat" )
407415 } )
408416
409417 it ( "normalises a company name with several comma-separated clauses" , async ( ) => {
410418 // This case is tricky, because we could tokenise on commas, but we only let people have one company, because otherwise the graph could be chaos.
411- const sponsor = await resolveAndNormalizeCompanyName ( "Red Hat, @xlate" )
412- expect ( sponsor ) . toBe ( "Red Hat" )
419+ const sponsor = await resolveAndNormalizeCompanyName ( "Orange Hat, @xlate" )
420+ expect ( sponsor ) . toBe ( "Orange Hat" )
413421 } )
414422
415423 it ( "normalises a company name with several @-delimited clauses" , async ( ) => {
@@ -478,7 +486,7 @@ describe("the github sponsor finder", () => {
478486 const contributors = await getContributors ( "someorg" , "someproject" )
479487 expect ( contributors . contributors ) . toContainEqual ( expect . objectContaining ( {
480488 login : "link-name" ,
481- company : "Red Hat"
489+ company : "Orange Hat"
482490 } ) )
483491 } )
484492 } )
@@ -502,7 +510,7 @@ describe("the github sponsor finder", () => {
502510 expect ( queryGraphQl ) . toHaveBeenCalled ( )
503511 expect ( contributors . companies ) . toHaveLength ( 3 )
504512 expect ( contributors . companies [ 1 ] ) . toStrictEqual ( {
505- "name" : "Red Hat" ,
513+ "name" : "Orange Hat" ,
506514 contributions : 4 ,
507515 contributors : 3
508516 } )
0 commit comments