diff --git a/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/index.test.ts b/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/index.test.ts new file mode 100644 index 00000000..a208350b --- /dev/null +++ b/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/index.test.ts @@ -0,0 +1,16 @@ +import quote from '.'; + +describe('quote', () => { + it('should return winner statement', () => { + expect.assertions(4); + + expect(quote('george saint pierre')).toBe('I am not impressed by your performance.'); + expect(quote('conor mcgregor')).toBe( + "I'd like to take this chance to apologize.. To absolutely NOBODY!", + ); + expect(quote('George Saint Pierre')).toBe('I am not impressed by your performance.'); + expect(quote('Conor McGregor')).toBe( + "I'd like to take this chance to apologize.. To absolutely NOBODY!", + ); + }); +}); diff --git a/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/index.ts b/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/index.ts new file mode 100644 index 00000000..a3a60058 --- /dev/null +++ b/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/index.ts @@ -0,0 +1,15 @@ +function quote(fighter: string): string | undefined { + const normalized = fighter.toLocaleLowerCase(); + + if (normalized.toLowerCase() === 'george saint pierre') { + return 'I am not impressed by your performance.'; + } + + if (normalized.toLocaleLowerCase() === 'conor mcgregor') { + return "I'd like to take this chance to apologize.. To absolutely NOBODY!"; + } + + return undefined; +} + +export default quote; diff --git a/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/readme.md b/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/readme.md new file mode 100644 index 00000000..f4621068 --- /dev/null +++ b/kata/8 kyu/for-ufc-fans-total-beginners-conor-mcgregor-vs-george-saint-pierre/readme.md @@ -0,0 +1,25 @@ +# [For UFC Fans (Total Beginners): Conor McGregor vs George Saint Pierre](https://www.codewars.com/kata/582dafb611d576b745000b74) + +This is a beginner friendly kata especially for UFC/MMA fans. + +It's a fight between the two legends: Conor McGregor vs George Saint Pierre in Madison Square Garden. Only one fighter will remain standing, and after the fight in an interview with Joe Rogan the winner will make his legendary statement. It's your job to return the right statement depending on the winner! + +If the winner is George Saint Pierre he will obviously say: + +- "I am not impressed by your performance." + +If the winner is Conor McGregor he will most undoubtedly say: + +- "I'd like to take this chance to apologize.. To absolutely NOBODY!" + +Good Luck! + +## Note + +The given name may varies in casing, eg., it can be "George Saint Pierre" or "geOrGe saiNT pieRRE". Your solution should treat both as the same thing (case-insensitive). + +--- + +## Tags + +- Fundamentals