Best JavaScript code snippet using fast-check-monorepo
chain.component.ts
Source:chain.component.ts
1import {Component, OnInit, ViewContainerRef, ViewEncapsulation, ViewChild } from '@angular/core';2import {ChainService} from '../services/chain.service';3import {AuthService} from '../services/auth.service';4import {SocketService} from '../services/socket.service';5import {Observable} from 'rxjs/Observable';6import {ActivatedRoute} from '@angular/router';7import { Overlay } from 'angular2-modal';8import { Modal } from 'angular2-modal/plugins/bootstrap';9import {ToasterContainerComponent, ToasterService} from 'angular2-toaster/angular2-toaster';10import {PopoverModule} from "ng2-popover";11import { UiSwitchModule } from 'angular2-ui-switch'12import { ModalComponent } from 'ng2-bs3-modal/ng2-bs3-modal';13import * as io from 'socket.io-client';14@Component({15 selector: 'chain',16 styleUrls: ['./chain.component.css'],17 templateUrl: './chain.component.html'18})19export class ChainComponent implements OnInit {20 chainId: string;21 selectedChainer: any = {};22 public chain:any = {};23 public loaded:boolean = false;24 private toasterService: ToasterService;25 connectionFullStream;26 connectionModeration;27 28 @ViewChild('approvalModal')29 approvalModal: ModalComponent;30 @ViewChild('refusalModal')31 refusalModal: ModalComponent;32 @ViewChild('displayModal')33 displayModal: ModalComponent;34 @ViewChild('deleteModal')35 deleteModal: ModalComponent;36 @ViewChild('inviteModal')37 inviteModal: ModalComponent;38 private url = 'https://backend.wechain.eu'; 39 private fullStreamSocket;40 private moderationSocket;41 sms: any = "Copy/Paste phone numbers (format 336/7XXXXXXXX) separated by commas";42 mails: any = "Copy/Paste emails separated by commas";43 constructor(public chainService: ChainService, private route: ActivatedRoute, overlay: Overlay, vcRef: ViewContainerRef, public modal: Modal, toasterService: ToasterService, private authService: AuthService) {44 overlay.defaultViewContainer = vcRef;45 this.toasterService = toasterService;46 this.chain.chainers = [];47 this.chain.moderation = [];48 }49 ngOnInit() {50 this.authService.valid();51 this.route.params.subscribe(params => {52 this.chainId = params['chainId'];53 if (this.chainId) {54 this.init(this.chainId);55 this.chain.chainers = [];56 this.chain.moderation = [];57 this.fullStreamSocket = io(this.url);58 let fullstream = {59 chunks_size : 200,60 delay : 10,61 stream : this.chainId+"_full_stream"62 }63 this.fullStreamSocket.emit('join', this.chainId+"_full_stream");64 this.fullStreamSocket.emit('init', fullstream);65 this.fullStreamSocket.on('data', (data) => {66 console.log("fullstream socket has received data event");67 this.chain.chainers = [];68 for (var i = 0 ; i < data.length; i++){69 if (i % 2 == 0){70 var chainer = JSON.parse(data[i]);71 this.chain.chainers.push(chainer);72 }73 }74 })75 this.fullStreamSocket.on('new_picture', (data) => {76 console.log("fullstream socket has received new_picture event");77 this.chain.chainers.push(data);78 })79 this.fullStreamSocket.on('delete_picture', (data) => {80 console.log("fullstream socket has received delete_picture event");81 for (var i = 0 ; i < this.chain.chainers.length ; i++){82 if (data._id == this.chain.chainers[i]._id){83 this.chain.chainers.splice(i,1);84 }85 }86 })87 this.moderationSocket = io(this.url);88 let moderation = {89 chunks_size : 200,90 delay : 10,91 stream : this.chainId+"_moderation"92 }93 this.moderationSocket.emit('join', this.chainId+"_moderation");94 this.moderationSocket.emit('init', moderation);95 this.moderationSocket.on('data', (data) => {96 console.log("moderation socket has received data event")97 this.chain.moderation = [];98 for (var i = 0 ; i < data.length; i++){99 if (i % 2 == 0){100 var chainer = JSON.parse(data[i]);101 this.chain.moderation.push(chainer);102 }103 }104 })105 this.moderationSocket.on('new_picture', (data) => {106 console.log("moderation socket has received new_picture event")107 this.chain.moderation.push(data);108 })109 this.moderationSocket.on('delete_picture', (data) => {110 console.log("fullstream socket has received delete_picture event");111 for (var i = 0 ; i < this.chain.moderation.length ; i++){112 if (data._id == this.chain.moderation[i]._id){113 this.chain.moderation.splice(i,1);114 }115 }116 })117 }118 });119 }120 init(chainId: string){121 this.chainService.getChain(this.chainId)122 .subscribe(chain => {123 console.log(chain)124 this.loaded = true;125 this.chain = chain;126 this.chain.chainers.push(this.chain.author);127 this.chain.moderation = [];128 if (this.chain.isAdvertising && chain.moderation_count > 0){129 this.chainService.getModeration(this.chainId)130 .subscribe(pictures => {131 console.log(pictures);132 for (var i = 0 ; i < pictures.length ; i++){133 this.chain.moderation.push(JSON.parse(pictures[i]));134 }135 136 });137 } 138 });139 }140 openChainer(chainer: any) {141 //$('#myModal').modal('toggle');142 console.log(chainer);143 //this.modal.chainer = chainer;144 }145 toggleModeration(){146 this.chainService.toggleModeration(this.chain._id)147 .subscribe(chain => {148 this.chain.isAdvertising = chain.isAdvertising;149 })150 }151 toggleQR(){152 this.chainService.toggleQR(this.chain._id)153 .subscribe(chain => {154 this.chain.display_qrcode = chain.display_qrcode;155 })156 }157 approve(chainer:any){158 this.selectedChainer = chainer159 this.approvalModal.open();160 }161 approveConfirmed(chainer:any){162 this.chainService.approve(this.chain._id,chainer._id)163 .subscribe(_ => {164 //this.init(this.chain._id);165 this.toasterService.pop('success', 'Picture approved', 'Picture from '+chainer.username+' has been successfully approved');166 this.approvalModal.close();167 })168 }169 approveCanceled(){170 this.selectedChainer = {};171 this.approvalModal.dismiss();172 }173 refuse(chainer:any){174 this.selectedChainer = chainer175 this.refusalModal.open();176 }177 refuseConfirmed(chainer:any){178 this.chainService.refuse(this.chain._id,chainer._id)179 .subscribe(_ => {180 //this.init(this.chain._id);181 this.toasterService.pop('success', 'Picture refused', 'Picture from '+chainer.username+' has been successfully refused');182 this.refusalModal.close();183 })184 }185 refuseCanceled(){186 this.selectedChainer = {};187 this.refusalModal.dismiss();188 }189 see(chainer:any){190 this.selectedChainer = chainer;191 this.displayModal.open();192 }193 deleteConfirmed(chainer: any){194 this.chainService.deleteChainer(this.chain._id,chainer._id, this.authService.token())195 .subscribe(_ => {196 //this.init(this.chain._id);197 this.toasterService.pop('success', 'Picture deleted', 'Picture from '+chainer.username+' has been successfully deleted');198 this.displayModal.close();199 this.deleteModal.close();200 })201 }202 delete(chainer:any){203 this.selectedChainer = chainer;204 this.deleteModal.open();205 }206 inviteMore(){207 this.inviteModal.open();208 }209 confirmInviteMore(){210 this.chainService.invite(this.chain._id,(this.sms ? this.sms.replace(/ /g, "").split(',') : []),(this.mails ? this.mails.replace(/ /g, "").split(',') : []),this.authService.token())211 .subscribe( res => {212 console.log(res);213 this.inviteModal.close();214 this.toasterService.pop('success', 'Invites sent', 'Your invites have been sent !');215 this.sms = "Copy/Paste phone numbers (format 336/7XXXXXXXX) separated by commas";216 this.mails = "Copy/Paste emails separated by commas";217 },218 err => {219 this.inviteModal.close();220 this.toasterService.pop('error', 'Error', 'Error occured during invitations. Please try again.');221 this.sms = "Copy/Paste phone numbers (format 336/7XXXXXXXX) separated by commas";222 this.mails = "Copy/Paste emails separated by commas";223 }224 )225 }226 refuseInviteMore(){227 this.inviteModal.close();228 this.sms = "Copy/Paste phone numbers (format 336/7XXXXXXXX) separated by commas";229 this.mails = "Copy/Paste emails separated by commas";230 }231 emptySMS() {232 if (this.sms == "Copy/Paste phone numbers (format 336/7XXXXXXXX) separated by commas"){233 this.sms = null;234 }235 }236 emptyMails() {237 if (this.mails == "Copy/Paste emails separated by commas"){238 this.mails = null;239 }240 }241 compareChainers(a,b) {242 if (a.created_at < b.created_at)243 return -1;244 if (a.created_at > b.created_at)245 return 1;246 return 0;247 }...
index.js
Source:index.js
1/// <reference types="cypress" />2function really() {3 if (!arguments.length) {4 throw new Error('really() needs arguments really badly')5 }6 const fns = Cypress._.takeWhile(arguments, (arg) => typeof arg === 'function')7 const chainerIndex = Cypress._.findIndex(8 arguments,9 (arg) => typeof arg === 'string',10 )11 if (chainerIndex === -1) {12 throw new Error('sh: no chainer found')13 }14 const chainer = arguments[chainerIndex]15 const chainerArguments = Cypress._.slice(arguments, chainerIndex + 1)16 const chainers = chainer.split('.')17 const fn = pipe(...fns)18 return function (value) {19 // console.log('value', value)20 const transformed = fn(value)21 // console.log('transformed', transformed)22 return chainers.reduce((acc, chainer) => {23 const currentChainer = acc[chainer]24 if (typeof currentChainer === 'function') {25 return acc[chainer](...chainerArguments)26 } else {27 return acc[chainer]28 }29 }, expect(transformed).to)30 }31}32function pipe(...fns) {33 return function (value) {34 return fns.reduce((acc, fn) => fn(acc), value)35 }36}37/**38 * Transforms an object or a list of objects using the supplied function or name of the property.39 * @param {Function} fn Function to apply to each object40 * @returns {Object|Array} Transformed value41 * @example cy.get('.todo').then(map('innerText'))42 */43function map(fn) {44 return function (list) {45 if (Cypress._.isArrayLike(list)) {46 const callbackFn = typeof fn === 'function' ? (x) => fn(x) : fn47 return Cypress._.map(list, callbackFn)48 } else {49 return fn(list)50 }51 }52}53/**54 * Filter the values by the given predicate function.55 * @param {Function} predicate56 */57function filter(predicate) {58 return function (list) {59 if (Cypress._.isArrayLike(list)) {60 const callbackFn =61 typeof predicate === 'function' ? (x) => predicate(x) : predicate62 return Cypress._.filter(list, callbackFn)63 } else {64 return predicate(list)65 }66 }67}68/**69 * Invokes the given name (with optional arguments) on the given object.70 * @param {String} methodName71 * @param {...any} args72 * @returns Result of the method invocation73 * @example74 * cy.get('dates')75 * .then(map('innerText'))76 * .then(toDate)77 * .then(invoke('getTime'))78 */79function invoke(methodName, ...args) {80 return function (list) {81 if (arguments.length > 1) {82 // the user tried to pass extra arguments with the list/object83 // that is a mistake!84 throw new Error(`Call to "${methodName}" must have a single argument`)85 }86 if (typeof list[methodName] === 'function') {87 return list[methodName](...args)88 }89 if (Cypress._.isArrayLike(list)) {90 return Cypress._.invokeMap(list, methodName, ...args)91 } else {92 return Cypress._.invoke(list, methodName, ...args)93 }94 }95}96/**97 * Grabs a property or a nested path from the given object.98 * @param {String} path99 * @returns Value of the property100 * @example101 * cy.wrap({ foo: 'bar' }).then(its('foo'))102 */103function its(path) {104 return function (o) {105 return Cypress._.property(path)(o)106 }107}108/**109 * Curried > N function110 * @param {number} n111 * @returns Boolean112 * @example113 * expect(greaterThan(10)(5)).to.be.false114 */115function greaterThan(n) {116 return function (x) {117 return x > n118 }119}120/**121 * Curried deep comparison122 * @param {any} isEqual123 */124function isEqual(expectedValue) {125 return function (actualValue) {126 return Cypress._.isEqual(actualValue, expectedValue)127 }128}129/**130 * Takes a function and returns a function that expects the first two131 * arguments in the reverse order.132 * @param {Function} fn Function to call133 * @returns Function134 * @example135 * flipTwoArguments(Cypress._.map)(x => x * 2, [1, 2, 3])136 */137function flipTwoArguments(fn) {138 return function (a, b) {139 return fn(b, a)140 }141}142/**143 * Converts the given string into a JavaScript Date object144 * @param {String} s dateString145 * @returns {Date} Date instance146 * @deprecated Use "constructor(Date)" instead147 */148function toDate(s) {149 return new Date(s)150}151/**152 * Returns a function that waits for the argument, passes that argument153 * to the given callback, but returns the original value. Useful154 * for debugging data transformations.155 * @param {Function} fn156 * @example cyw.wrap(1).then(tap(console.log)).should('equal', 1)157 */158function tap(fn) {159 return function (x) {160 fn(x)161 return x162 }163}164/**165 * Returns a function with the first argument bound.166 * @param {Function} fn Function to partially apply167 * @param {any} a First argument to apply168 * @example169 * const add = (a, b) => a + b170 * const addOne = partial(add, 1)171 * addOne(2) // 3172 */173function partial(fn, a) {174 return fn.bind(null, a)175}176/**177 * Given a constructor function, returns a function178 * that waits for a single argument before calling "new constructor(arg)"179 * @example constructor(Date)180 * @see https://glebbahmutov.com/blog/work-around-the-keyword-new-in-javascript/181 */182function construct(constructor) {183 return function (arg) {184 return new constructor(arg)185 }186}187module.exports = {188 really,189 // utility functions190 map,191 construct,192 invoke,193 filter,194 its,195 pipe,196 toDate,197 tap,198 partial,199 isEqual,200 greaterThan,201 flipTwoArguments,...
server.js
Source:server.js
1FD31.plugin("server", function($) {2/*!3 * jquery.server.4 * Extension of jquery.ajax with ability to parse server commands.5 *6 * Copyright (c) 2011 Jason Ramos7 * www.stackideas.com8 *9 * Dual licensed under the MIT and GPL licenses:10 * http://www.opensource.org/licenses/mit-license.php11 * http://www.gnu.org/licenses/gpl.html12 *13 */14var self = $.server = function(options) {15 var request = $.Deferred(),16 ajaxOptions = $.extend(true, {}, self.defaultOptions, options, {success: function(){}});17 request.xhr = $.Ajax(ajaxOptions)18 .done(function(commands){19 if (typeof commands==="string") {20 try {21 commands = $.parseJSON(commands);22 } catch(e) {23 request.rejectWith(request, ["Unable to parse Ajax commands.", "error"])24 }25 }26 27 if (!$.isArray(commands)) {28 request.rejectWith(request, ["Invalid ajax commands.", "error"]);29 } else {30 var parse = function(command){31 var type = command.type,32 parser = self.parsers[type] || options[type];33 if ($.isFunction(parser)) {34 return parser.apply(request, command.data);35 }36 }37 // Execute all the notifications first38 var commands = $.map(commands, function(command) {39 if (command.type=="notify") {40 parse(command);41 } else {42 return command;43 }44 })45 $.each(commands, function(i, command) {46 parse(command);47 });48 }49 // If server did not resolve this request50 if (request.state()==="pending") {51 // We'll resolve it ourselves52 request.resolveWith(request);53 }54 })55 .fail(function(xhr, status, statusText){56 request.rejectWith(request, [statusText, status]);57 });58 return request;59};60self.defaultOptions = {61 type: 'POST',62 data: {63 tmpl: 'component',64 format: 'ajax',65 no_html: 166 },67 dataType: 'json'68};69self.parsers = {70 script: function() {71 var data = $.makeArray(arguments);72 // For hardcoded javascript codes73 if (typeof data[0] == 'string') {74 try { eval(data[0]) } catch(err) {};75 return;76 }77 /**78 * Execute each method and assign returned object back to the chain.79 *80 * Foundry().attr('checked', true);81 * is equivalent to:82 * window['Foundry']('.element')[attr]('checked', true);83 */84 var chain = window, chainBroken = false;85 $.each(data, function(i, chainer)86 {87 if (chainer.property==="Foundry") {88 chainer.property = $.globalNamespace;89 }90 if (chainer.method==="Foundry") {91 chainer.method = $.globalNamespace;92 }93 try {94 switch(chainer.type)95 {96 case 'get':97 chain = chain[chainer.property];98 break;99 case 'set':100 chain[chainer.property] = chainer.value;101 chainBroken=true;102 break;103 case 'call':104 chain = chain[chainer.method].apply(chain, chainer.args);105 break;106 }107 } catch(err) {108 chainBroken = true;109 }110 })111 },112 resolve: function() {113 this.resolveWith(this, arguments);114 },115 reject: function() {116 this.rejectWith(this, arguments);117 },118 notify: function() {119 this.notifyWith(this, arguments);120 },121 redirect: function(url) {122 window.location = url;123 }124};...
Using AI Code Generation
1const fc = require('fast-check');2const { chainer } = require('fast-check');3const add = (a, b) => a + b;4const sub = (a, b) => a - b;5const mul = (a, b) => a * b;6const chainerAdd = chainer(add);7const chainerSub = chainer(sub);8const chainerMul = chainer(mul);9fc.assert(10 fc.property(11 fc.integer(),12 fc.integer(),13 fc.integer(),14 (a, b, c) => chainerAdd(a, b, c) === chainerAdd(chainerAdd(a, b), c),15);16fc.assert(17 fc.property(18 fc.integer(),19 fc.integer(),20 fc.integer(),21 (a, b, c) => chainerSub(a, b, c) === chainerSub(chainerSub(a, b), c),22);23fc.assert(24 fc.property(25 fc.integer(),26 fc.integer(),27 fc.integer(),28 (a, b, c) => chainerMul(a, b, c) === chainerMul(chainerMul(a, b), c),29);30fc.assert(31 fc.property(32 fc.integer(),33 fc.integer(),34 fc.integer(),35 (a, b, c) => chainerAdd(a, b, c) === chainerSub(chainerMul(a, b), c),36);37fc.assert(38 fc.property(39 fc.integer(),40 fc.integer(),41 fc.integer(),42 (a, b, c) => chainerAdd(a, b, c) === chainerMul(chainerSub(a, b), c),43);44fc.assert(45 fc.property(46 fc.integer(),47 fc.integer(),48 fc.integer(),49 (a, b, c) => chainerAdd(a, b, c) === chainerSub(chainerAdd(a, b), c),50);51fc.assert(52 fc.property(53 fc.integer(),54 fc.integer(),55 fc.integer(),56 (a, b, c) => chainerMul(a, b, c) === chainerSub(chainerAdd(a, b), c),57);
Using AI Code Generation
1const fc = require('fast-check').default;2const { chainer } = require('fast-check-monorepo');3const fc = require('fast-check').default;4const { chainer } = require('fast-check-monorepo');5fc.assert(6 fc.property(7 fc.integer(),8 fc.integer(),9 chainer((a, b) => {10 })11);12const fc = require('fast-check').default;13const { chainer } = require('fast-check-monorepo');14fc.assert(15 fc.property(16 fc.integer(),17 fc.integer(),18 chainer((a, b) => {19 })20);21const fc = require('fast-check').default;22const { chainer } = require('fast-check-monorepo');23fc.assert(24 fc.property(25 fc.integer(),26 fc.integer(),27 chainer((a, b) => {28 })29);30const fc = require('fast-check').default;31const { chainer } = require('fast-check-monorepo');32fc.assert(33 fc.property(34 fc.integer(),35 fc.integer(),36 chainer((a, b) => {37 })38);39const fc = require('fast-check').default;40const { chainer } = require('fast-check-monorepo');41fc.assert(42 fc.property(43 fc.integer(),44 fc.integer(),45 chainer((a, b) => {46 })47);48const fc = require('fast-check').default;49const { chainer } = require('fast-check-monorepo');50fc.assert(51 fc.property(52 fc.integer(),53 fc.integer(),54 chainer((a, b) => {55 })56);
Using AI Code Generation
1const fc = require('fast-check');2fc.configureGlobal({3});4fc.assert(5 fc.property(fc.integer(), fc.integer(), (a, b) => {6 return a + b === b + a;7 }),8);9const fc = require('fast-check');10fc.assert(11 fc.property(fc.integer(), fc.integer(), (a, b) => {12 return a + b === b + a;13 }),14);15const fc = require('fast-check');16fc.assert(17 fc.property(fc.integer(), fc.integer(), (a, b) => {18 return a + b === b + a;19 }),20);21const fc = require('fast-check');22fc.assert(23 fc.property(fc.integer(), fc.integer(), (a, b) => {24 return a + b === b + a;25 }),26);27const fc = require('fast-check');28fc.assert(29 fc.property(fc.integer(), fc.integer(), (a, b) => {30 return a + b === b + a;31 }),32);33const fc = require('fast-check');34fc.assert(35 fc.property(fc.integer(), fc.integer(), (a, b) => {36 return a + b === b + a;37 }),38);39const fc = require('fast-check');40fc.assert(41 fc.property(fc.integer(), fc.integer(), (a, b) => {42 return a + b === b + a;43 }),44);45const fc = require('fast-check');46fc.assert(47 fc.property(fc.integer(), fc.integer(), (a, b) => {48 return a + b === b + a;49 }),50);51const fc = require('fast-check');52fc.assert(53 fc.property(fc.integer(), fc.integer(), (a, b) => {54 return a + b === b + a;55 }),56);
Using AI Code Generation
1const {chainer} = require('fast-check');2describe('test', () => {3 it('test', () => {4 chainer()5 .add('test', () => {6 return 1;7 })8 .add('test2', () => {9 return 2;10 })11 .add('test3', () => {12 return 3;13 })14 .add('test4', () => {15 return 4;16 })17 .add('test5', () => {18 return 5;19 })20 .add('test6', () => {21 return 6;22 })23 .add('test7', () => {24 return 7;25 })26 .add('test8', () => {27 return 8;28 })29 .add('test9', () => {30 return 9;31 })32 .add('test10', () => {33 return 10;34 })35 .add('test11', () => {36 return 11;37 })38 .add('test12', () => {39 return 12;40 })41 .add('test13', () => {42 return 13;43 })44 .add('test14', () => {45 return 14;46 })47 .add('test15', () => {48 return 15;49 })50 .add('test16', () => {51 return 16;52 })53 .add('test17', () => {54 return 17;55 })56 .add('test18', () => {57 return 18;58 })59 .add('test19', () => {60 return 19;61 })62 .add('test20', () => {63 return 20;64 })65 .add('test21', () => {66 return 21;67 })68 .add('test22', () => {69 return 22;70 })71 .add('test23', () => {72 return 23;73 })74 .add('test24', () => {75 return 24;76 })77 .add('test25', () => {78 return 25;79 })80 .add('test26', () => {81 return 26;82 })83 .add('test27', () => {84 return 27;85 })86 .add('test28', () => {
Using AI Code Generation
1const fc = require('fast-check');2const {chainer} = require('fast-check-monorepo');3const {chain} = chainer(fc);4const {integer} = fc;5const {isEven, isOdd} = require('./isEvenOrOdd');6const isEvenOrOdd = chain(isEven, isOdd);7fc.assert(fc.property(integer(), isEvenOrOdd));8function isEven(n) {9 return n % 2 === 0;10}11function isOdd(n) {12 return n % 2 !== 0;13}14module.exports = {15};16import * as fc from 'fast-check';17import {chainer} from 'fast-check-monorepo';18import {chain} from chainer(fc);19import {integer} from fc;20import {isEven, isOdd} from './isEvenOrOdd';21const isEvenOrOdd = chain(isEven, isOdd);22fc.assert(fc.property(integer(), isEvenOrOdd));23function isEven(n: number): boolean {24 return n % 2 === 0;25}26function isOdd(n: number): boolean {27 return n % 2 !== 0;28}29export {isEven, isOdd};30import * as fc from 'fast-check';31import {chainer} from 'fast-check-monorepo';32import {chain} from chainer(fc);33import {integer} from fc;34import {isEven, isOdd} from './isEvenOrOdd';35const isEvenOrOdd = chain(isEven, isOdd);36fc.assert(fc.property(integer(), isEvenOrOdd));37function isEven(n: number): boolean {
Using AI Code Generation
1const {chainer} = require('fast-check');2const {add} = require('./add');3const {multiply} = require('./multiply');4chainer()5 .add(multiply)6 .add(add)7 .run();8const {assert} = require('chai');9const {add} = require('./add');10describe('Add functionality', function() {11 it('should add two numbers', function() {12 assert.equal(add(1, 2), 3);13 });14});15const {assert} = require('chai');16const {multiply} = require('./multiply');17describe('Multiply functionality', function() {18 it('should multiply two numbers', function() {19 assert.equal(multiply(1, 2), 2);20 });21});22const add = (a, b) => a + b;23module.exports = {add};24const multiply = (a, b) => a * b;25module.exports = {multiply};
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!