Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //MOCHA: let isOddOrEven = require("../mocha1").isOddOrEven
- let expect = require("chai").expect;
- describe("Test isOddOrEven(string)", function() {
- it("should return odd for (13)", function() {
- let expectedKind = 'odd'
- let actualKind = isOddOrEven(13)
- expect(expectedKind).to.be.odd(actualKind)
- })
- })
- console.log(isOddOrEven(15))
- // КОД ЗА ТЕСТВАНЕ:
- function isOddOrEven(string) {
- if (typeof(string) !== 'string') {
- return undefined;
- }
- if (string.length % 2 === 0) {
- return "even";
- }
- return "odd";
- }
- module.exports = {isOddOrEven}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement