let greeting = { en: 'Hello',es: 'Hola', de: 'Hallo',fr: 'Bonjour', ja: 'こんにちは',ro: 'buna', ru: 'Здравствуйте',zh: '你好', ko: '안녕하세요',tr: 'Merhaba', vi: 'xin chào'} const sayHello = (lang,name) => lang ? `${greeting[lang]} ${name}!` : "I don't speak that langauge"
function sayHello(input) {return !input ? "Hello World!" : "Hello " + input + "!"};- let greeting = {
- en: 'Hello',es: 'Hola',
- de: 'Hallo',fr: 'Bonjour',
- ja: 'こんにちは',ro: 'buna',
- ru: 'Здравствуйте',zh: '你好',
- ko: '안녕하세요',tr: 'Merhaba',
- vi: 'xin chào'}
- const sayHello = (lang,name) => lang ? `${greeting[lang]} ${name}!` : "I don't speak that langauge"
describe("given we are annonymous", () => { it("should say hello world", () => { Test.assertEquals(sayHello('en',"World"), "Hello World!"); }); it("should say hello amigo", () => { Test.assertEquals(sayHello('es',"Amigo"), "Hola Amigo!"); }); it("should say hello akira", () => { Test.assertEquals(sayHello('ja',"Akira"), "こんにちは Akira!"); }); it("should say sorry i don't speak that langauge", () => { Test.assertEquals(sayHello("","Lelani"), "I don't speak that langauge"); }); });
- describe("given we are annonymous", () => {
- it("should say hello world", () => {
Test.assertEquals(sayHello(), "Hello World!");- Test.assertEquals(sayHello('en',"World"), "Hello World!");
- });
- it("should say hello amigo", () => {
Test.assertEquals(sayHello("Amigo"), "Hello Amigo!");- Test.assertEquals(sayHello('es',"Amigo"), "Hola Amigo!");
- });
- it("should say hello akira", () => {
- Test.assertEquals(sayHello('ja',"Akira"), "こんにちは Akira!");
- });
- it("should say sorry i don't speak that langauge", () => {
- Test.assertEquals(sayHello("","Lelani"), "I don't speak that langauge");
- });
- });