Skip to content

Instantly share code, notes, and snippets.

View kubarskii's full-sized avatar
☀️
Working from home

Alexander Kubarskii kubarskii

☀️
Working from home
  • EPAM Systems
  • Russia, Saint-Petersburg/Turkey, Antalya
View GitHub Profile
@kubarskii
kubarskii / test-lib.js
Last active March 24, 2021 22:03
A try to create some kind of small testing lib that compares expected result and actual (made in educational purposes). Currently tests works properly only with sync functions.
function testExecutor(value) {
const A = function (x) {
this.value = x;
this.success = false;
};
A.prototype.toBe = function (x) {
if (JSON.stringify(x) === JSON.stringify(this.value) && typeof this.value === typeof x) {
this.success = true;
console.log(`%cPassed: ${JSON.stringify(x)} equals ${JSON.stringify(this.value)}`, 'color: green;');