Best Python code snippet using hypothesis
plugin.test.js
Source:plugin.test.js
1"use strict";2var chai = require("chai");3var sinon = require("sinon");4var expect = chai.expect;5var plugin = require("../lib/plugin.js");6var slice = Array.prototype.slice;7chai.config.includeStack = true;8chai.use(require("sinon-chai"));9describe("plugin", function () {10 it("should be a function", function () {11 expect(plugin).to.be.a("function");12 });13});14describe("plugin(fn)", function () {15 it("should return a function", function () {16 expect(plugin(function () {})).to.be.a("function");17 });18 describe("calling the returned function with (obj, config?)", function () {19 var spy, newPlugin, obj;20 beforeEach(function () {21 spy = sinon.spy();22 newPlugin = plugin(spy);23 obj = {};24 });25 it("should pass obj to fn", function () {26 newPlugin(obj);27 expect(spy).to.have.been.calledWith(obj);28 });29 it("should pass obj and config to fn", function () {30 var config = {};31 newPlugin(obj, config);32 expect(spy).to.have.been.calledWith(obj, config);33 });34 it("should mark the obj so the plugin can't be applied twice on the same obj", function () {35 newPlugin(obj);36 newPlugin(obj);37 expect(spy).to.have.been.calledOnce;38 });39 });40});41describe("fn's context", function () {42 var spy;43 var newPlugin;44 var obj;45 function createPlugin(fn) {46 spy = sinon.spy(fn);47 newPlugin = plugin(spy);48 }49 function applyPlugin() {50 newPlugin(obj);51 expect(spy).to.have.been.calledOnce;52 }53 function runTests(onOtherObj) {54 var target;55 beforeEach(function () {56 if (onOtherObj) {57 target = {};58 } else {59 target = obj;60 }61 });62 describe(".store()", function () {63 it("should return an object", function () {64 createPlugin(function () {65 expect(this(target).store()).to.be.an("object");66 });67 applyPlugin();68 });69 it("should make the store not enumerable", function () {70 createPlugin(function () {71 this(target).store();72 });73 applyPlugin();74 expect(Object.keys(target)).to.eql([]);75 });76 it("should return always the same object for obj", function () {77 createPlugin(function () {78 expect(this(target).store()).to.equal(this(target).store());79 });80 applyPlugin();81 });82 it("should return different objects for different targets", function () {83 createPlugin(function () {84 expect(this(target).store()).to.not.equal(this({}).store());85 });86 applyPlugin();87 });88 });89 describe(".before(key, preFn)", function () {90 var calls, preFn, someMethod;91 beforeEach(function () {92 calls = [];93 target.someMethod = someMethod = sinon.spy(function () {94 calls.push("someMethod");95 return "someMethod's return value";96 });97 });98 it("should replace the original method", function () {99 createPlugin(function () {100 this(target).before("someMethod", function () {});101 });102 applyPlugin();103 expect(target.someMethod).to.not.equal(someMethod);104 });105 it("should run preFn and then the original method", function () {106 createPlugin(function () {107 this(target).before("someMethod", preFn = sinon.spy(function () {108 calls.push("preFn");109 }));110 });111 applyPlugin();112 target.someMethod();113 expect(calls).to.eql(["preFn", "someMethod"]);114 });115 it("should pass the given arguments to preFn and to the original method", function () {116 createPlugin(function () {117 this(target).before("someMethod", preFn = sinon.spy());118 });119 applyPlugin();120 target.someMethod(1, 2, 3);121 expect(preFn).to.have.been.calledWithExactly(1, 2, 3);122 expect(someMethod).to.have.been.calledWithExactly(1, 2, 3);123 });124 it("should call preFn and the original method on the expected context", function () {125 var ctx = {};126 createPlugin(function () {127 this(target).before("someMethod", preFn = sinon.spy());128 });129 applyPlugin();130 target.someMethod();131 expect(preFn).to.have.been.calledOn(target);132 expect(someMethod).to.have.been.calledOn(target);133 target.someMethod.call(ctx);134 expect(preFn).to.have.been.calledOn(ctx);135 expect(someMethod).to.have.been.calledOn(ctx);136 });137 it("should enable preFn to override the args for the original method", function () {138 createPlugin(function () {139 var self = this;140 this(target).before("someMethod", function () {141 self.override.args = ["b"];142 });143 });144 applyPlugin();145 target.someMethod("a");146 expect(someMethod).to.have.been.calledWithExactly("b");147 });148 it("should not alter the return value of the original method", function () {149 createPlugin(function () {150 this(target).before("someMethod", function () {});151 });152 applyPlugin();153 expect(target.someMethod()).to.equal("someMethod's return value");154 });155 it("should throw an error if there is no function with the given key", function () {156 createPlugin(function () {157 this(target).before("nonExistentMethod", function () {});158 });159 expect(function () {160 applyPlugin();161 }).to.throw("Cannot hook before method: Property 'nonExistentMethod' is not typeof function, instead saw undefined");162 });163 });164 describe(".after(key, postFn)", function () {165 var calls, postFn, someMethod;166 beforeEach(function () {167 calls = [];168 target.someMethod = someMethod = sinon.spy(function () {169 calls.push("someMethod");170 return "someMethod's return value";171 });172 });173 it("should replace the original method", function () {174 createPlugin(function () {175 this(target).after("someMethod", function () {});176 });177 applyPlugin();178 expect(target.someMethod).to.not.equal(someMethod);179 });180 it("should run the original method and then postFn", function () {181 createPlugin(function () {182 this(target).after("someMethod", postFn = sinon.spy(function () {183 calls.push("postFn");184 }));185 });186 applyPlugin();187 target.someMethod();188 expect(calls).to.eql(["someMethod", "postFn"]);189 });190 it("should pass the result and the original arguments to postFn", function () {191 createPlugin(function () {192 this(target).after("someMethod", postFn = sinon.spy());193 });194 applyPlugin();195 target.someMethod(1, 2, 3);196 expect(postFn.firstCall.args[0]).to.equal("someMethod's return value");197 expect(slice.call(postFn.firstCall.args[1])).to.eql([1, 2, 3]);198 });199 it("should call postFn and the original method on the expected context", function () {200 var ctx = {};201 createPlugin(function () {202 this(target).after("someMethod", postFn = sinon.spy());203 });204 applyPlugin();205 target.someMethod();206 expect(postFn).to.have.been.calledOn(target);207 expect(someMethod).to.have.been.calledOn(target);208 target.someMethod.call(ctx);209 expect(postFn).to.have.been.calledOn(ctx);210 expect(someMethod).to.have.been.calledOn(ctx);211 });212 it("should not alter the arguments for the original method", function () {213 createPlugin(function () {214 this(target).after("someMethod", function () {});215 });216 applyPlugin();217 target.someMethod(1, 2, 3);218 expect(someMethod).to.have.been.calledWithExactly(1, 2, 3);219 });220 it("should not alter the return value of the original method", function () {221 createPlugin(function () {222 this(target).after("someMethod", function () {});223 });224 applyPlugin();225 expect(target.someMethod()).to.equal("someMethod's return value");226 });227 it("should enable postFn to override the return value of the original method", function () {228 createPlugin(function () {229 var self = this;230 this(target).after("someMethod", function () {231 self.override.result = "overridden value";232 });233 });234 applyPlugin();235 expect(target.someMethod()).to.equal("overridden value");236 });237 it("should throw an error if there is no function with the given key", function () {238 createPlugin(function () {239 this(target).after("nonExistentMethod", function () {});240 });241 expect(function () {242 applyPlugin();243 }).to.throw("Cannot hook after method: Property 'nonExistentMethod' is not typeof function, instead saw undefined");244 });245 });246 describe(".override(key, fn)", function () {247 var someMethod;248 beforeEach(function () {249 target.someMethod = someMethod = sinon.spy(function () {250 return "someMethod's return value";251 });252 });253 it("should give fn the full control over when to call the original method via pluginContext.overridden", function (done) {254 createPlugin(function () {255 var pluginContext = this;256 this(target).override("someMethod", function () {257 setTimeout(function () {258 pluginContext.overridden();259 }, 0);260 });261 });262 applyPlugin();263 target.someMethod();264 expect(someMethod).to.not.have.been.called;265 setTimeout(function () {266 expect(someMethod).to.have.been.calledOnce;267 done();268 }, 10);269 });270 it("should return the returned result", function () {271 var result;272 createPlugin(function () {273 this(target).override("someMethod", function () {274 return "overridden result";275 });276 });277 applyPlugin();278 expect(target.someMethod()).to.equal("overridden result");279 });280 it("should throw an error if there is no function with the given key", function () {281 createPlugin(function () {282 this(target).override("nonExistentMethod", function () {});283 });284 expect(function () {285 applyPlugin();286 }).to.throw("Cannot override method: Property 'nonExistentMethod' is not typeof function, instead saw undefined");287 });288 });289 describe(".define(key, value)", function () {290 it("should define the property with the given key and value if it is undefined", function () {291 createPlugin(function () {292 this(target).define("someValue", 2);293 this(target).define("someMethod", function () {294 return this.someValue;295 });296 });297 applyPlugin();298 expect(target).to.have.property("someValue", 2);299 expect(target).to.have.property("someMethod");300 expect(target.someMethod()).to.equal(2);301 });302 it("should throw an error if the property is already defined", function () {303 createPlugin(function () {304 this(target).define("someValue", 2);305 });306 target.someValue = 1;307 expect(function () {308 applyPlugin();309 }).to.throw("Cannot define property 'someValue': There is already a property with value 1");310 });311 it("should take the whole prototype chain into account", function () {312 var child = Object.create(target);313 createPlugin(function () {314 this(child).define("someValue", 2);315 });316 target.someValue = 1;317 expect(function () {318 applyPlugin();319 }).to.throw("Cannot define property 'someValue': There is already a property with value 1");320 });321 it("should even work on undefined properties which aren't enumerable", function () {322 var child = Object.create(target);323 createPlugin(function () {324 this(child).define("someValue", 2);325 });326 Object.defineProperty(target, "someValue", {327 enumerable: false,328 writable: true329 });330 expect(function () {331 applyPlugin();332 }).to.throw("Cannot define property 'someValue': There is already a property with value undefined");333 });334 });335 describe(".hook(key, fn)", function () {336 it("should define the method if it is undefined", function () {337 function fn() {}338 createPlugin(function () {339 this(target).hook("someMethod", fn);340 });341 expect(target).to.not.have.property("someMethod");342 applyPlugin();343 expect(target).to.have.property("someMethod", fn);344 });345 it("should hook before the method if the property is already a function", function () {346 var secondSpy;347 var thirdSpy;348 createPlugin(function () {349 this(target).hook("someMethod", secondSpy = sinon.spy());350 });351 target.someMethod = thirdSpy = sinon.spy(function () {352 expect(secondSpy).to.have.been.calledOnce;353 });354 applyPlugin();355 target.someMethod();356 expect(thirdSpy).to.have.been.calledOnce;357 });358 it("should throw an error if the property is not a function", function () {359 createPlugin(function () {360 this(target).hook("someMethod", function () {});361 });362 target.someMethod = 1;363 expect(function () {364 applyPlugin();365 }).to.throw("Cannot hook into method 'someMethod': Expected 'someMethod' to be a function, instead saw 1");366 });367 it("should take the whole prototype chain into account", function () {368 var child = Object.create(target);369 createPlugin(function () {370 this(child).hook("someMethod", function () {});371 });372 target.someMethod = 1;373 expect(function () {374 applyPlugin();375 }).to.throw("Cannot hook into method 'someMethod': Expected 'someMethod' to be a function, instead saw 1");376 });377 it("should even work on undefined properties which aren't enumerable", function () {378 var child = Object.create(target);379 createPlugin(function () {380 this(child).hook("someMethod", function () {});381 });382 Object.defineProperty(target, "someMethod", {383 enumerable: false,384 writable: true385 });386 expect(function () {387 applyPlugin();388 }).to.throw("Cannot hook into method 'someMethod': Expected 'someMethod' to be a function, instead saw undefined");389 });390 });391 }392 beforeEach(function () {393 obj = {};394 });395 it("should be typeof function", function () {396 createPlugin();397 applyPlugin();398 expect(spy.thisValues[0]).to.be.a("function");399 });400 describe("called with (obj)", function () {401 describe("working on obj", function () {402 runTests(false);403 });404 describe("working on some other obj", function () {405 runTests(true);406 });407 });...
java_deobfuscate_test.py
Source:java_deobfuscate_test.py
1#!/usr/bin/env python2#3# Copyright 2017 The Chromium Authors. All rights reserved.4# Use of this source code is governed by a BSD-style license that can be5# found in the LICENSE file.6"""Tests for java_deobfuscate."""7import argparse8import os9import subprocess10import sys11import tempfile12import unittest13# Set by command-line argument.14_JAVA_DEOBFUSCATE_PATH = None15LINE_PREFIXES = [16 '',17 # logcat -v threadtime18 '09-08 14:38:35.535 18029 18084 E qcom_sensors_hal: ',19 # logcat20 'W/GCM (15158): ',21 'W/GCM ( 158): ',22]23TEST_MAP = """\24this.was.Deobfuscated -> FOO:25 int[] mFontFamily -> a26 1:3:void someMethod(int,android.os.Bundle):65:67 -> bar27never.Deobfuscated -> NOTFOO:28 int[] mFontFamily -> a29 1:3:void someMethod(int,android.os.Bundle):65:67 -> bar30"""31TEST_DATA = [32 '',33 'FOO',34 'FOO.bar',35 'Here is a FOO',36 'Here is a class FOO',37 'Here is a class FOO baz',38 'Here is a "FOO" baz',39 'Here is a type "FOO" baz',40 'Here is a "FOO.bar" baz',41 'SomeError: SomeFrameworkClass in isTestClass for FOO',42 'Here is a FOO.bar',43 'Here is a FOO.bar baz',44 'END FOO#bar',45 'new-instance 3810 (LSome/Framework/Class;) in LFOO;',46 'FOO: Error message',47 'Caused by: FOO: Error message',48 '\tat FOO.bar(PG:1)',49 '\t at\t FOO.bar\t (\t PG:\t 1\t )',50 ('Unable to start activity ComponentInfo{garbage.in/here.test}:'51 ' java.lang.NullPointerException: Attempt to invoke interface method'52 ' \'void FOO.bar(int,android.os.Bundle)\' on a null object reference'),53 ('Caused by: java.lang.NullPointerException: Attempt to read from field'54 ' \'int[] FOO.a\' on a null object reference'),55 'java.lang.VerifyError: FOO',56 ('java.lang.NoSuchFieldError: No instance field a of type '57 'Ljava/lang/Class; in class LFOO;'),58 'NOTFOO: Object of type FOO was not destroyed...',59]60EXPECTED_OUTPUT = [61 '',62 'this.was.Deobfuscated',63 'this.was.Deobfuscated.someMethod',64 'Here is a FOO',65 'Here is a class this.was.Deobfuscated',66 'Here is a class FOO baz',67 'Here is a "FOO" baz',68 'Here is a type "this.was.Deobfuscated" baz',69 'Here is a "this.was.Deobfuscated.someMethod" baz',70 'SomeError: SomeFrameworkClass in isTestClass for this.was.Deobfuscated',71 'Here is a this.was.Deobfuscated.someMethod',72 'Here is a FOO.bar baz',73 'END this.was.Deobfuscated#someMethod',74 'new-instance 3810 (LSome/Framework/Class;) in Lthis/was/Deobfuscated;',75 'this.was.Deobfuscated: Error message',76 'Caused by: this.was.Deobfuscated: Error message',77 '\tat this.was.Deobfuscated.someMethod(Deobfuscated.java:65)',78 ('\t at\t this.was.Deobfuscated.someMethod\t '79 '(\t Deobfuscated.java:\t 65\t )'),80 ('Unable to start activity ComponentInfo{garbage.in/here.test}:'81 ' java.lang.NullPointerException: Attempt to invoke interface method'82 ' \'void this.was.Deobfuscated.someMethod(int,android.os.Bundle)\' on a'83 ' null object reference'),84 ('Caused by: java.lang.NullPointerException: Attempt to read from field'85 ' \'int[] this.was.Deobfuscated.mFontFamily\' on a null object reference'),86 'java.lang.VerifyError: this.was.Deobfuscated',87 ('java.lang.NoSuchFieldError: No instance field mFontFamily of type '88 'Ljava/lang/Class; in class Lthis/was/Deobfuscated;'),89 'NOTFOO: Object of type this.was.Deobfuscated was not destroyed...',90]91TEST_DATA = [s + '\n' for s in TEST_DATA]92EXPECTED_OUTPUT = [s + '\n' for s in EXPECTED_OUTPUT]93class JavaDeobfuscateTest(unittest.TestCase):94 def __init__(self, *args, **kwargs):95 super(JavaDeobfuscateTest, self).__init__(*args, **kwargs)96 self._map_file = None97 def setUp(self):98 self._map_file = tempfile.NamedTemporaryFile()99 self._map_file.write(TEST_MAP)100 self._map_file.flush()101 def tearDown(self):102 if self._map_file:103 self._map_file.close()104 def _testImpl(self, input_lines=None, expected_output_lines=None,105 prefix=''):106 self.assertTrue(bool(input_lines) == bool(expected_output_lines))107 if not input_lines:108 input_lines = [prefix + x for x in TEST_DATA]109 if not expected_output_lines:110 expected_output_lines = [prefix + x for x in EXPECTED_OUTPUT]111 cmd = [_JAVA_DEOBFUSCATE_PATH, self._map_file.name]112 proc = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE)113 proc_output, _ = proc.communicate(''.join(input_lines))114 actual_output_lines = proc_output.splitlines(True)115 for actual, expected in zip(actual_output_lines, expected_output_lines):116 self.assertTrue(117 actual == expected or actual.replace('bar', 'someMethod') == expected,118 msg=''.join([119 'Deobfuscation failed.\n',120 ' actual: %s' % actual,121 ' expected: %s' % expected]))122 def testNoPrefix(self):123 self._testImpl(prefix='')124 def testThreadtimePrefix(self):125 self._testImpl(prefix='09-08 14:38:35.535 18029 18084 E qcom_sensors_hal: ')126 def testStandardPrefix(self):127 self._testImpl(prefix='W/GCM (15158): ')128 def testStandardPrefixWithPadding(self):129 self._testImpl(prefix='W/GCM ( 158): ')130 @unittest.skip('causes java_deobfuscate to hang, see crbug.com/876539')131 def testIndefiniteHang(self):132 # Test for crbug.com/876539.133 self._testImpl(134 input_lines=[135 'VFY: unable to resolve virtual method 2: LFOO;'136 + '.onDescendantInvalidated '137 + '(Landroid/view/View;Landroid/view/View;)V',138 ],139 expected_output_lines=[140 'VFY: unable to resolve virtual method 2: Lthis.was.Deobfuscated;'141 + '.onDescendantInvalidated '142 + '(Landroid/view/View;Landroid/view/View;)V',143 ])144if __name__ == '__main__':145 parser = argparse.ArgumentParser()146 parser.add_argument('--java-deobfuscate-path', type=os.path.realpath,147 required=True)148 known_args, unittest_args = parser.parse_known_args()149 _JAVA_DEOBFUSCATE_PATH = known_args.java_deobfuscate_path150 unittest_args = [sys.argv[0]] + unittest_args...
failover.js
Source:failover.js
1/* global describe, it, afterEach, beforeEach */2/* globals Promise:true */3const expect = require('chai').expect4const _ = require('lodash')5const Promise = require('bluebird')6const simplydit = require('simplydit')7var errors = require('../../lib/errors')8const Failover = require('../../lib/connector/failover')9describe('failover connection', function () {10 let failover11 const sources = ['source 1', 'source 2', 'source 3']12 const mocks = {}13 class FakeChromanode {14 constructor(opts) {15 this.opts = opts16 this._socket = { status: 'connected' }17 }18 on() {19 }20 _doOpen() {21 if (mocks.doOpen) {22 mocks.doOpen(...arguments)23 }24 }25 someMethod() {26 if (mocks.someMethod) {27 return mocks.someMethod(...arguments)28 }29 }30 }31 afterEach(function() {32 for (let name in mocks) {33 if (mocks.hasOwnProperty(name)) {34 mocks[name].verify()35 }36 }37 })38 it('instantiates a new chromanode', function(done) {39 failover = new Failover.FailoverChromanodeConnector({40 sources,41 clazz: FakeChromanode42 })43 mocks.doOpen = simplydit.mock('doOpen', simplydit.func)44 mocks.doOpen.expectCallWith().andReturn(null)45 failover.pickSource().then(source => {46 expect(source.node).to.be.instanceof(FakeChromanode)47 expect(source.node.opts.source).to.equal('source 1')48 delete mocks.doOpen49 done()50 })51 })52 it('returns different nodes after fail', function(done) {53 failover = new Failover.FailoverChromanodeConnector({54 sources,55 clazz: FakeChromanode,56 maxRetries: 257 })58 failover.pickSource().then(source1 => {59 return failover.pickSource()60 }).then(source1 => {61 expect(source1.node.opts.source).to.equal('source 1')62 source1.errored()63 return failover.pickSource()64 }).then(source2 => {65 expect(source2.node.opts.source).to.equal('source 2')66 source2.errored()67 return failover.pickSource()68 }).then(source3 => {69 source3.errored()70 return failover.pickSource()71 }).then(source1 => {72 expect(source1.node.opts.source).to.equal('source 1')73 done()74 })75 })76 it('tries with a different source if a network error happens', function(done) {77 failover = new Failover.FailoverChromanodeConnector({78 sources,79 clazz: FakeChromanode,80 maxRetries: 381 })82 // TODO: Change interface, automatically assign all of methods on Chromanode83 // (maybe by defining a getter)84 mocks.someMethod = simplydit.mock('someMethod', simplydit.func) 85 const requestFunction = failover.decorate('someMethod')86 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())87 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())88 mocks.someMethod.expectCallWith().andReturn(simplydit.promise('return'))89 requestFunction().then(() => {90 expect(failover.nodes[0].state).to.equal('FAILED')91 expect(failover.nodes[1].state).to.equal('FAILED')92 expect(failover.nodes[2].state).to.equal('LOADED')93 done()94 })95 })96 it('max retry limit is respected', function(done) {97 failover = new Failover.FailoverChromanodeConnector({98 sources,99 clazz: FakeChromanode,100 maxRetries: 3101 })102 mocks.someMethod = simplydit.mock('someMethod', simplydit.func) 103 const requestFunction = failover.decorate('someMethod')104 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())105 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())106 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())107 requestFunction().catch(error => {108 expect(error).to.be.instanceof(errors.Connector.FailoverConnectionError)109 done()110 })111 })112 it('round robins (retry with earlier nodes)', function(done) {113 failover = new Failover.FailoverChromanodeConnector({114 sources,115 clazz: FakeChromanode,116 maxRetries: 5117 })118 mocks.someMethod = simplydit.mock('someMethod', simplydit.func) 119 const requestFunction = failover.decorate('someMethod')120 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())121 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())122 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())123 mocks.someMethod.expectCallWith().andThrow(new errors.Connector.Unreachable())124 mocks.someMethod.expectCallWith().andReturn(simplydit.promise('return'))125 requestFunction().then(() => {126 expect(failover.nodes[0].state).to.equal('FAILED')127 expect(failover.nodes[1].state).to.equal('LOADED')128 expect(failover.nodes[2].state).to.equal('FAILED')129 done()130 })131 })...
indent.js
Source:indent.js
1// test: indent_only2const 3 foo 4 = 5 1 6 + 7 28 ;9const foo = 10 [1, 2];11const foo = [12 1, 2];13const foo = 14 {a, b};15const foo = {16 a, b};17someMethod(foo, [18 0, 1, 2,], bar);19someMethod(20 foo, 21 [0, 1, 2,], 22 bar);23someMethod(foo, [24 0, 1, 25 2,26], bar);27someMethod(28 foo,29 [30 1, 2],);31someMethod(32 foo,33 [1, 2],34 );35someMethod(foo, {36 a: 1, b: 2,}, bar);37someMethod(38 foo, 39 {a: 1, b: 2,}, 40 bar);41someMethod(foo, {42 a: 1, b: 243}, bar);44someMethod(45 foo,46 {47 a: 1, b: 2},);48someMethod(49 foo,50 {a: 1, b: 2},51 );52someMethod(a => 53 a*254 );55someMethod(a => {56 a*2}57 );58foo()59 .bar(a => a*2);60foo().bar(a => 61 a*2);62foo = 63 function() {64 65};66foo =67 function() {68 69};70switch (foo) {71 case 1: return b;}72switch (foo) {73 case 1: 74 return b;}75class Foo {76 77}78class Foo {79 bar(80 ) {}81}82class Foo {83 bar() {84 85 }86}87if (x) {88 statement;89 90 more;...
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!!