Created
March 2, 2021 04:31
-
-
Save Kozlove1/97363a6574d4ee2ceab2cba1d4d5c953 to your computer and use it in GitHub Desktop.
Module_16
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function repeatWord(word, count) { | |
let arrWord = [] | |
for (let i = 1; i <= count; i++) { | |
arrWord += word + ' ' | |
} | |
return (arrWord) | |
} | |
console.log(repeatWord('лиса', 3)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {repeatWord} from './Work1.js'; | |
describe('test for repeatWord function',() => { | |
it('should repeat word 3 times',() => { | |
expect(repeatWord('лиса', 3)).toBe("лиса лиса лиса ") | |
}), | |
it('we see two fox not a two dog',() => { | |
expect(repeatWord('fox', 2)).not.toBe("dog dog ") | |
}) | |
}) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function createAdder(a) { | |
return function addA(b) { | |
return a + b; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {createAdder} from "./Work2"; | |
describe('return function addA, which takes b and returns a + b', () => { | |
it('return anything', () => { | |
expect.anything() | |
}) | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Касаемо Work2 я хотел осуществить проверку, которая бы подтвердила возврат функции addA()