Commit babfef41 authored by Giannis Kepas's avatar Giannis Kepas
Browse files

assignment-1 tests

parent 9a3f7646
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
node_modules/
.vscode/
+2 −2
Original line number Diff line number Diff line
@@ -7,7 +7,7 @@
    // Enforcing
    "bitwise"       : true,     // true: Prohibit bitwise operators (&, |, ^, etc.)
    "camelcase"     : false,    // true: Identifiers must be in camelCase
    "curly"         : true,     // true: Require {} for every new block or scope
    "curly"         : false,     // true: Require {} for every new block or scope
    "eqeqeq"        : true,     // true: Require triple equals (===) for comparison
    "forin"         : true,     // true: Require filtering for..in loops with obj.hasOwnProperty()
    "freeze"        : true,     // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
@@ -38,7 +38,7 @@
    "varstmt"       : false,    // true: Disallow any var statements. Only `let` and `const` are allowed.

    // Relaxing
    "asi"           : false,     // true: Tolerate Automatic Semicolon Insertion (no semicolons)
    "asi"           : true,     // true: Tolerate Automatic Semicolon Insertion (no semicolons)
    "boss"          : false,     // true: Tolerate assignments where comparisons would be expected
    "debug"         : false,     // true: Allow debugger statements e.g. browser breakpoints.
    "eqnull"        : false,     // true: Tolerate use of `== null`
+5 −6
Original line number Diff line number Diff line
import myEmailAddress from "../solution_01.js";
import helloWorld from "../solution_01.js";
import assert from 'assert';


describe('\n\nSolution_01', function() {
  describe('#myEmailAddress()', function() {
    it("should return student's email address", function() {
      assert.equal(myEmailAddress(), process.env.GITLAB_USER_EMAIL);
describe('solution_01.js', function () {
  describe('helloWorld()', function () {
    it("should return \"Hello world!\"", function () {
      assert.equal(helloWorld(), "Hello world!");
    });
  });
});
+6 −16
Original line number Diff line number Diff line
import isEvenExceptTwoOrFour from "../solution_02.js";
import sayHello from "../solution_02.js";
import assert from "assert";

describe("\n\nSolution_02", function () {
  describe("#isEvenExceptTwoOrFour()", function () {
    it("should return false for odd numbers", function () {
      [1, 3, 5, 7, 9, 115, 143].forEach((i) => {
        assert.equal(isEvenExceptTwoOrFour(i), false);
      });
    });
    it("should return false for 2 and 4", function () {
      [2, 4].forEach((i) => {
        assert.equal(isEvenExceptTwoOrFour(i), false);
      });
    });
    it("should return true for the rest of even numbers", function () {
      [6, 8, 10, 12, 14, 256, 1024].forEach((i) => {
        assert.equal(isEvenExceptTwoOrFour(i), true);
describe("solution_02.js", function () {
  describe("sayHello()", function () {
    it("should return the correct string", function () {
      ["thename", "Jim", "John", "Jane"].forEach((str) => {
        assert.equal(sayHello(str), `Hello ${str}, how are you?`);
      });
    });
  });
+6 −6
Original line number Diff line number Diff line
import sayHello from "../solution_03.js";
import addNumbers from "../solution_03.js";
import assert from "assert";

describe("\n\nSolution_03", function () {
  describe("#test_with_various_names()", function () {
    it("should return the correct string", function () {
      ["thename", "jim", "john", "Jane"].forEach((str) => {
        assert.equal(sayHello(str), `Hello ${str}, how are you?`);
describe("solution_03.js", function () {
  describe("addNumbers(a, b)", function () {
    it("should return the correct result", function () {
      [1, 2, 3, 4, 5].forEach((num) => {
        assert.equal(addNumbers(num, num), num + num);
      });
    });
  });
Loading