Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"liveServer.settings.port": 5501
}
1 change: 1 addition & 0 deletions CNAME
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
www.google.com
14 changes: 7 additions & 7 deletions __tests__/01_variable_and_scope.test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
let __ = undefined;

describe('var...', () => {
xdescribe('var...', () => {
function iterator(bool) {
if (bool) {
var name = 'Hackages';
Expand All @@ -10,14 +10,14 @@ describe('var...', () => {

it('what do you expect?', () => {
const actual = iterator(true);
expect(actual).toEqual(__);
expect(actual).toEqual('Hackages');
});
});

describe('let...', () => {
xdescribe('let...', () => {
function iterator(bool) {
let variable = 'Hackages';
if (bool) {
let variable = 'Hackages';
}
// you can see that the variable is not defined, that's because of the block scope
//TODO Make the test pass by declaring the variable before the if
Expand All @@ -27,7 +27,7 @@ describe('let...', () => {
it('what do you expect?', () => {
const actual = iterator(true);

expect(actual).toEqual(__);
expect(actual).toEqual('Hackages');
});
});

Expand All @@ -39,7 +39,7 @@ describe('scope', () => {
var b = 2;
const actual = foo(2);

expect(actual).toEqual(__);
expect(actual).toEqual(4);
});

it('Scope 2', () => {
Expand All @@ -52,6 +52,6 @@ describe('scope', () => {
return result;
}
const actual = foo(2);
expect(actual).toEqual(__);
expect(actual).toEqual(10);
});
});
40 changes: 20 additions & 20 deletions __tests__/02_A_types.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@ let __ = undefined;

xdescribe('typeof...', () => {
it('object, number, boolean, string, function...', () => {
expect(typeof {}).toEqual(__);
expect(typeof []).toEqual(__);
expect(typeof 'hackages').toEqual(__);
expect(typeof -5).toEqual(__);
expect(typeof false).toEqual(__);
expect(typeof NaN).toEqual(__);
expect(typeof undefined).toEqual(__);
expect(typeof null).toEqual(__);
expect(typeof Symbol(12)).toEqual(__);
expect(typeof function () {}).toEqual(__);
expect(typeof {}).toEqual("object");
expect(typeof []).toEqual("object");
expect(typeof 'hackages').toEqual("string");
expect(typeof -5).toEqual("number");
expect(typeof false).toEqual("boolean");
expect(typeof NaN).toEqual("number");
expect(typeof undefined).toEqual("undefined");
expect(typeof null).toEqual("object");
expect(typeof Symbol(12)).toEqual("symbol");
expect(typeof function () {}).toEqual("function");
});

it('Everything is an object', () => {
expect(Object.prototype.toString.call({})).toEqual(__);
expect(Object.prototype.toString.call([])).toEqual(__);
expect(Object.prototype.toString.call('hackages')).toEqual(__);
expect(Object.prototype.toString.call(-5)).toEqual(__);
expect(Object.prototype.toString.call(false)).toEqual(__);
expect(Object.prototype.toString.call(NaN)).toEqual(__);
expect(Object.prototype.toString.call(undefined)).toEqual(__);
expect(Object.prototype.toString.call(null)).toEqual(__);
expect(Object.prototype.toString.call(Symbol(12))).toEqual(__);
expect(Object.prototype.toString.call(function () {})).toEqual(__);
expect(Object.prototype.toString.call({})).toEqual("[object Object]");
expect(Object.prototype.toString.call([])).toEqual("[object Array]");
expect(Object.prototype.toString.call('hackages')).toEqual("[object String]");
expect(Object.prototype.toString.call(-5)).toEqual("[object Number]");
expect(Object.prototype.toString.call(false)).toEqual("[object Boolean]");
expect(Object.prototype.toString.call(NaN)).toEqual("[object Number]");
expect(Object.prototype.toString.call(undefined)).toEqual("[object Undefined]");
expect(Object.prototype.toString.call(null)).toEqual("[object Null]");
expect(Object.prototype.toString.call(Symbol(12))).toEqual("[object Symbol]");
expect(Object.prototype.toString.call(function () {})).toEqual("[object Function]");
});
});
20 changes: 10 additions & 10 deletions __tests__/02_B_basics_equality_truthyness.test.js
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
let __ = undefined;

xdescribe('Basics JavaScript concepts', () => {
describe('Basics JavaScript concepts', () => {
describe('About Equality', () => {
it('numeric equality', () => {
expect(3 == 4).toEqual(__);
expect(3 == 4).toEqual(false);
});

it('string equality', () => {
expect('3' == '7').toEqual(__);
expect('3' == '7').toEqual(false);
});

it('equality without type coercion', () => {
expect(3 == '3').toEqual(__);
expect(3 == '3').toEqual(false);
});

it('equality with type coercion', () => {
expect(3 == '3').toEqual(__);
expect(3 === '3').toEqual(__);
expect(3 == '3').toEqual(false);
expect(3 === '3').toEqual(true);
});

it('equality with object', () => {
const vic = { name: 'Vic' };
const milen = vic;
expect(vic === milen).toEqual(__);
expect(vic === { name: 'Vic' }).toEqual(__);
expect(vic === milen).toEqual(true);
expect(vic === { name: 'Vic' }).toEqual(true);
});

it('Are 2 strings equal?', () => {
const apple = 'apple';
expect('apple' === apple).toEqual(__);
expect('apple' === apple).toEqual(true);
});

it('How about NaN', () => {
expect(NaN === NaN).toEqual(__);
expect(NaN === NaN).toEqual(false);
});
});

Expand Down
Loading