Best JavaScript code snippet using ava
test.js
Source:test.js
1/* */ 2var assert = require('./assert');3var keys = Object.keys;4function makeBlock(f) {5 var args = Array.prototype.slice.call(arguments, 1);6 return function() {7 return f.apply(this, args);8 };9}10test('assert.ok', function() {11 assert.throws(makeBlock(assert, false), assert.AssertionError, 'ok(false)');12 assert.doesNotThrow(makeBlock(assert, true), assert.AssertionError, 'ok(true)');13 assert.doesNotThrow(makeBlock(assert, 'test', 'ok(\'test\')'));14 assert.throws(makeBlock(assert.ok, false), assert.AssertionError, 'ok(false)');15 assert.doesNotThrow(makeBlock(assert.ok, true), assert.AssertionError, 'ok(true)');16 assert.doesNotThrow(makeBlock(assert.ok, 'test'), 'ok(\'test\')');17});18test('assert.equal', function() {19 assert.throws(makeBlock(assert.equal, true, false), assert.AssertionError, 'equal');20 assert.doesNotThrow(makeBlock(assert.equal, null, null), 'equal');21 assert.doesNotThrow(makeBlock(assert.equal, undefined, undefined), 'equal');22 assert.doesNotThrow(makeBlock(assert.equal, null, undefined), 'equal');23 assert.doesNotThrow(makeBlock(assert.equal, true, true), 'equal');24 assert.doesNotThrow(makeBlock(assert.equal, 2, '2'), 'equal');25 assert.doesNotThrow(makeBlock(assert.notEqual, true, false), 'notEqual');26 assert.throws(makeBlock(assert.notEqual, true, true), assert.AssertionError, 'notEqual');27});28test('assert.strictEqual', function() {29 assert.throws(makeBlock(assert.strictEqual, 2, '2'), assert.AssertionError, 'strictEqual');30 assert.throws(makeBlock(assert.strictEqual, null, undefined), assert.AssertionError, 'strictEqual');31 assert.doesNotThrow(makeBlock(assert.notStrictEqual, 2, '2'), 'notStrictEqual');32});33test('assert.deepEqual - 7.2', function() {34 assert.doesNotThrow(makeBlock(assert.deepEqual, new Date(2000, 3, 14), new Date(2000, 3, 14)), 'deepEqual date');35 assert.throws(makeBlock(assert.deepEqual, new Date(), new Date(2000, 3, 14)), assert.AssertionError, 'deepEqual date');36});37test('assert.deepEqual - 7.3', function() {38 assert.doesNotThrow(makeBlock(assert.deepEqual, /a/, /a/));39 assert.doesNotThrow(makeBlock(assert.deepEqual, /a/g, /a/g));40 assert.doesNotThrow(makeBlock(assert.deepEqual, /a/i, /a/i));41 assert.doesNotThrow(makeBlock(assert.deepEqual, /a/m, /a/m));42 assert.doesNotThrow(makeBlock(assert.deepEqual, /a/igm, /a/igm));43 assert.throws(makeBlock(assert.deepEqual, /ab/, /a/));44 assert.throws(makeBlock(assert.deepEqual, /a/g, /a/));45 assert.throws(makeBlock(assert.deepEqual, /a/i, /a/));46 assert.throws(makeBlock(assert.deepEqual, /a/m, /a/));47 assert.throws(makeBlock(assert.deepEqual, /a/igm, /a/im));48 var re1 = /a/;49 re1.lastIndex = 3;50 assert.throws(makeBlock(assert.deepEqual, re1, /a/));51});52test('assert.deepEqual - 7.4', function() {53 assert.doesNotThrow(makeBlock(assert.deepEqual, 4, '4'), 'deepEqual == check');54 assert.doesNotThrow(makeBlock(assert.deepEqual, true, 1), 'deepEqual == check');55 assert.throws(makeBlock(assert.deepEqual, 4, '5'), assert.AssertionError, 'deepEqual == check');56});57test('assert.deepEqual - 7.5', function() {58 assert.doesNotThrow(makeBlock(assert.deepEqual, {a: 4}, {a: 4}));59 assert.doesNotThrow(makeBlock(assert.deepEqual, {60 a: 4,61 b: '2'62 }, {63 a: 4,64 b: '2'65 }));66 assert.doesNotThrow(makeBlock(assert.deepEqual, [4], ['4']));67 assert.throws(makeBlock(assert.deepEqual, {a: 4}, {68 a: 4,69 b: true70 }), assert.AssertionError);71 assert.doesNotThrow(makeBlock(assert.deepEqual, ['a'], {0: 'a'}));72 assert.doesNotThrow(makeBlock(assert.deepEqual, {73 a: 4,74 b: '1'75 }, {76 b: '1',77 a: 478 }));79 var a1 = [1, 2, 3];80 var a2 = [1, 2, 3];81 a1.a = 'test';82 a1.b = true;83 a2.b = true;84 a2.a = 'test';85 assert.throws(makeBlock(assert.deepEqual, keys(a1), keys(a2)), assert.AssertionError);86 assert.doesNotThrow(makeBlock(assert.deepEqual, a1, a2));87});88test('assert.deepEqual - instances', function() {89 var nbRoot = {toString: function() {90 return this.first + ' ' + this.last;91 }};92 function nameBuilder(first, last) {93 this.first = first;94 this.last = last;95 return this;96 }97 nameBuilder.prototype = nbRoot;98 function nameBuilder2(first, last) {99 this.first = first;100 this.last = last;101 return this;102 }103 nameBuilder2.prototype = nbRoot;104 var nb1 = new nameBuilder('Ryan', 'Dahl');105 var nb2 = new nameBuilder2('Ryan', 'Dahl');106 assert.doesNotThrow(makeBlock(assert.deepEqual, nb1, nb2));107 nameBuilder2.prototype = Object;108 nb2 = new nameBuilder2('Ryan', 'Dahl');109 assert.throws(makeBlock(assert.deepEqual, nb1, nb2), assert.AssertionError);110});111test('assert.deepEqual - ES6 primitives', function() {112 assert.throws(makeBlock(assert.deepEqual, null, {}), assert.AssertionError);113 assert.throws(makeBlock(assert.deepEqual, undefined, {}), assert.AssertionError);114 assert.throws(makeBlock(assert.deepEqual, 'a', ['a']), assert.AssertionError);115 assert.throws(makeBlock(assert.deepEqual, 'a', {0: 'a'}), assert.AssertionError);116 assert.throws(makeBlock(assert.deepEqual, 1, {}), assert.AssertionError);117 assert.throws(makeBlock(assert.deepEqual, true, {}), assert.AssertionError);118 if (typeof Symbol === 'symbol') {119 assert.throws(makeBlock(assert.deepEqual, Symbol(), {}), assert.AssertionError);120 }121});122test('assert.deepEqual - object wrappers', function() {123 assert.doesNotThrow(makeBlock(assert.deepEqual, new String('a'), ['a']));124 assert.doesNotThrow(makeBlock(assert.deepEqual, new String('a'), {0: 'a'}));125 assert.doesNotThrow(makeBlock(assert.deepEqual, new Number(1), {}));126 assert.doesNotThrow(makeBlock(assert.deepEqual, new Boolean(true), {}));127});128function thrower(errorConstructor) {129 throw new errorConstructor('test');130}131test('assert - Testing the throwing', function() {132 var aethrow = makeBlock(thrower, assert.AssertionError);133 aethrow = makeBlock(thrower, assert.AssertionError);134 assert.throws(makeBlock(thrower, assert.AssertionError), assert.AssertionError, 'message');135 assert.throws(makeBlock(thrower, assert.AssertionError), assert.AssertionError);136 assert.throws(makeBlock(thrower, assert.AssertionError));137 assert.throws(makeBlock(thrower, TypeError));138 var threw = false;139 try {140 assert.throws(makeBlock(thrower, TypeError), assert.AssertionError);141 } catch (e) {142 threw = true;143 assert.ok(e instanceof TypeError, 'type');144 }145 assert.equal(true, threw, 'a.throws with an explicit error is eating extra errors', assert.AssertionError);146 threw = false;147 try {148 assert.doesNotThrow(makeBlock(thrower, TypeError), assert.AssertionError);149 } catch (e) {150 threw = true;151 assert.ok(e instanceof TypeError);152 }153 assert.equal(true, threw, 'a.doesNotThrow with an explicit error is eating extra errors');154 try {155 assert.doesNotThrow(makeBlock(thrower, TypeError), TypeError);156 } catch (e) {157 threw = true;158 assert.ok(e instanceof assert.AssertionError);159 }160 assert.equal(true, threw, 'a.doesNotThrow is not catching type matching errors');161});162test('assert.ifError', function() {163 assert.throws(function() {164 assert.ifError(new Error('test error'));165 });166 assert.doesNotThrow(function() {167 assert.ifError(null);168 });169 assert.doesNotThrow(function() {170 assert.ifError();171 });172});173test('assert - make sure that validating using constructor really works', function() {174 var threw = false;175 try {176 assert.throws(function() {177 throw ({});178 }, Array);179 } catch (e) {180 threw = true;181 }182 assert.ok(threw, 'wrong constructor validation');183});184test('assert - use a RegExp to validate error message', function() {185 assert.throws(makeBlock(thrower, TypeError), /test/);186});187test('assert - se a fn to validate error object', function() {188 assert.throws(makeBlock(thrower, TypeError), function(err) {189 if ((err instanceof TypeError) && /test/.test(err)) {190 return true;191 }192 });193});194test('assert - Make sure deepEqual doesn\'t loop forever on circular refs', function() {195 var b = {};196 b.b = b;197 var c = {};198 c.b = c;199 var gotError = false;200 try {201 assert.deepEqual(b, c);202 } catch (e) {203 gotError = true;204 }205 assert.ok(gotError);206});207test('assert - Ensure reflexivity of deepEqual with `arguments` objects', function() {208 var args = (function() {209 return arguments;210 })();211 assert.throws(makeBlock(assert.deepEqual, [], args), assert.AssertionError);212 assert.throws(makeBlock(assert.deepEqual, args, []), assert.AssertionError);213});214test('assert - test assertion message', function() {215 function testAssertionMessage(actual, expected) {216 try {217 assert.equal(actual, '');218 } catch (e) {219 assert.equal(e.toString(), ['AssertionError:', expected, '==', '""'].join(' '));220 }221 }222 testAssertionMessage(undefined, '"undefined"');223 testAssertionMessage(null, 'null');224 testAssertionMessage(true, 'true');225 testAssertionMessage(false, 'false');226 testAssertionMessage(0, '0');227 testAssertionMessage(100, '100');228 testAssertionMessage(NaN, '"NaN"');229 testAssertionMessage(Infinity, '"Infinity"');230 testAssertionMessage(-Infinity, '"-Infinity"');231 testAssertionMessage('', '""');232 testAssertionMessage('foo', '"foo"');233 testAssertionMessage([], '[]');234 testAssertionMessage([1, 2, 3], '[1,2,3]');235 testAssertionMessage(/a/, '"/a/"');236 testAssertionMessage(function f() {}, '"function f() {}"');237 testAssertionMessage({}, '{}');238 testAssertionMessage({239 a: undefined,240 b: null241 }, '{"a":"undefined","b":null}');242 testAssertionMessage({243 a: NaN,244 b: Infinity,245 c: -Infinity246 }, '{"a":"NaN","b":"Infinity","c":"-Infinity"}');247});248test('assert - regressions from node.js testcase', function() {249 var threw = false;250 try {251 assert.throws(function() {252 assert.ifError(null);253 });254 } catch (e) {255 threw = true;256 assert.equal(e.message, 'Missing expected exception..');257 }258 assert.ok(threw);259 try {260 assert.equal(1, 2);261 } catch (e) {262 assert.equal(e.toString().split('\n')[0], 'AssertionError: 1 == 2');263 }264 try {265 assert.equal(1, 2, 'oh no');266 } catch (e) {267 assert.equal(e.toString().split('\n')[0], 'AssertionError: oh no');268 }...
callContext.js
Source:callContext.js
1"use strict";2var sinon = require("sinon");3var AssertionError = require("chai").AssertionError;4var expect = require("chai").expect;5describe("Call context", function () {6 var spy = null;7 var target = null;8 var notTheTarget = null;9 beforeEach(function () {10 spy = sinon.spy();11 target = {};12 notTheTarget = {};13 });14 describe("calledOn", function () {15 it("should throw an assertion error if the spy is never called", function () {16 expect(function () {17 spy.should.have.been.calledOn(target);18 }).to.throw(AssertionError);19 });20 it("should throw an assertion error if the spy is called without a context", function () {21 spy();22 expect(function () {23 spy.should.have.been.calledOn(target);24 }).to.throw(AssertionError);25 expect(function () {26 spy.getCall(0).should.have.been.calledOn(target);27 }).to.throw(AssertionError);28 });29 it("should throw an assertion error if the spy is called on the wrong context", function () {30 spy.call(notTheTarget);31 expect(function () {32 spy.should.have.been.calledOn(target);33 }).to.throw(AssertionError);34 expect(function () {35 spy.getCall(0).should.have.been.calledOn(target);36 }).to.throw(AssertionError);37 });38 it("should not throw if the spy is called on the specified context", function () {39 spy.call(target);40 expect(function () {41 spy.should.have.been.calledOn(target);42 }).to.not.throw();43 expect(function () {44 spy.getCall(0).should.have.been.calledOn(target);45 }).to.not.throw();46 });47 it("should not throw if the spy is called on another context and also the specified context", function () {48 spy.call(notTheTarget);49 spy.call(target);50 expect(function () {51 spy.should.have.been.calledOn(target);52 }).to.not.throw();53 expect(function () {54 spy.getCall(1).should.have.been.calledOn(target);55 }).to.not.throw();56 });57 });58 describe("always calledOn", function () {59 it("should throw an assertion error if the spy is never called", function () {60 expect(function () {61 spy.should.always.have.been.calledOn(target);62 }).to.throw(AssertionError);63 expect(function () {64 spy.should.have.always.been.calledOn(target);65 }).to.throw(AssertionError);66 expect(function () {67 spy.should.have.been.always.calledOn(target);68 }).to.throw(AssertionError);69 });70 it("should throw an assertion error if the spy is called without a context", function () {71 spy();72 expect(function () {73 spy.should.always.have.been.calledOn(target);74 }).to.throw(AssertionError);75 expect(function () {76 spy.should.have.always.been.calledOn(target);77 }).to.throw(AssertionError);78 expect(function () {79 spy.should.have.been.always.calledOn(target);80 }).to.throw(AssertionError);81 });82 it("should throw an assertion error if the spy is called on the wrong context", function () {83 spy.call(notTheTarget);84 expect(function () {85 spy.should.always.have.been.calledOn(target);86 }).to.throw(AssertionError);87 expect(function () {88 spy.should.have.always.been.calledOn(target);89 }).to.throw(AssertionError);90 expect(function () {91 spy.should.have.been.always.calledOn(target);92 }).to.throw(AssertionError);93 });94 it("should not throw if the spy is called on the specified context", function () {95 spy.call(target);96 expect(function () {97 spy.should.always.have.been.calledOn(target);98 }).to.not.throw();99 expect(function () {100 spy.should.have.always.been.calledOn(target);101 }).to.not.throw();102 expect(function () {103 spy.should.have.been.always.calledOn(target);104 }).to.not.throw();105 });106 it("should throw an assertion error if the spy is called on another context and also the specified context",107 function () {108 spy.call(notTheTarget);109 spy.call(target);110 expect(function () {111 spy.should.always.have.been.calledOn(target);112 }).to.throw(AssertionError);113 expect(function () {114 spy.should.have.always.been.calledOn(target);115 }).to.throw(AssertionError);116 expect(function () {117 spy.should.have.been.always.calledOn(target);118 }).to.throw(AssertionError);119 });120 });...
assertionerror.test.js
Source:assertionerror.test.js
1import {VERSION} from '../../../src/ol/util.js';2import AssertionError from '../../../src/ol/AssertionError.js';3describe('ol.AssertionError', function() {4 it('generates an error', function() {5 const error = new AssertionError(42);6 expect(error).to.be.an(Error);7 });8 it('generates a message with a versioned url', function() {9 const error = new AssertionError(42);10 const path = VERSION ? VERSION.split('-')[0] : 'latest';11 expect(error.message).to.be('Assertion failed. See https://openlayers.org/en/' + path + '/doc/errors/#42 for details.');12 });13 it('has an error code', function() {14 const error = new AssertionError(42);15 expect(error.code).to.be(42);16 });17 it('has a name', function() {18 const error = new AssertionError(42);19 expect(error.name).to.be('AssertionError');20 });21 it('is instanceof Error and AssertionError', function() {22 const error = new AssertionError(42);23 expect(error instanceof Error).to.be(true);24 expect(error instanceof AssertionError).to.be(true);25 });...
Using AI Code Generation
1const test = require('ava');2test('foo', t => {3 t.throws(() => {4 throw new TypeError('foo');5 }, TypeError);6 t.throws(() => {7 throw new TypeError('bar');8 }, 'bar');9 t.throws(() => {10 throw new TypeError('bar');11 }, /bar/);12 t.throws(() => {13 throw new TypeError('bar');14 }, TypeError, 'bar');15 t.throws(() => {16 throw new TypeError('bar');17 }, TypeError, /bar/);18 t.notThrows(() => {});19 t.notThrows(() => {20 throw new TypeError('foo');21 }, TypeError);22 t.notThrows(() => {23 throw new TypeError('foo');24 }, 'foo');25 t.notThrows(() => {26 throw new TypeError('foo');27 }, /foo/);28 t.notThrows(() => {29 throw new TypeError('foo');30 }, TypeError, 'foo');31 t.notThrows(() => {32 throw new TypeError('foo');33 }, TypeError, /foo/);34});
Using AI Code Generation
1test('foo', t => {2 t.throws(() => {3 throw new TypeError('bar');4 }, TypeError);5 t.throws(() => {6 throw new TypeError('bar');7 }, TypeError, 'throws with a message');8 t.throws(() => {9 throw new TypeError('bar');10 }, /bar/);11 t.throws(() => {12 throw new TypeError('bar');13 }, /bar/, 'throws with a message');14 t.throws(() => {15 throw new TypeError('bar');16 }, {instanceOf: TypeError});17 t.throws(() => {18 throw new TypeError('bar');19 }, {instanceOf: TypeError}, 'throws with a message');20 t.throws(() => {21 throw new TypeError('bar');22 }, {message: 'bar'});23 t.throws(() => {24 throw new TypeError('bar');25 }, {message: 'bar'}, 'throws with a message');26 t.throws(() => {27 throw new TypeError('bar');28 }, {message: /bar/});29 t.throws(() => {30 throw new TypeError('bar');31 }, {message: /bar/}, 'throws with a message');32 t.throws(() => {33 throw new TypeError('bar');34 }, {code: 'ERR_ASSERTION'});35 t.throws(() => {36 throw new TypeError('bar');37 }, {code: 'ERR_ASSERTION'}, 'throws with a message');38 t.throws(() => {39 throw new TypeError('bar');40 }, {name: 'TypeError'});41 t.throws(() => {42 throw new TypeError('bar');43 }, {name: 'TypeError'}, 'throws with a message');44 t.throws(() => {45 throw new TypeError('bar');46 }, {name: 'TypeError', code: 'ERR_ASSERTION'});47 t.throws(() => {48 throw new TypeError('bar');49 }, {name: 'TypeError', code: 'ERR_ASSERTION'}, 'throws with a message');50 t.throws(() => {51 throw new TypeError('bar');52 }, {instanceOf: TypeError, code: 'ERR_ASSERTION'});53 t.throws(() => {54 throw new TypeError('bar');55 }, {instanceOf: TypeError, code: 'ERR_ASSERTION'}, 'throws with a message');56 t.throws(() => {57 throw new TypeError('bar');58 }, {instanceOf:
Using AI Code Generation
1import test from 'ava';2test('foo', t => {3 t.throws(() => {4 throw new TypeError('foo bar baz');5 }, TypeError);6});7test('bar', t => {8 const err = t.throws(() => {9 throw new TypeError('foo bar baz');10 }, TypeError);11 t.is(err.message, 'foo bar baz');12});13import test from 'ava';14test('bar', t => {15 t.ifError(0);16 t.ifError(false);17 t.ifError(undefined);18 t.ifError(null);19 t.ifError('');20 t.ifError(NaN);21 t.ifError([]);22 t.ifError({});23});24import test from 'ava';25test('foo', t => {26 t.notThrows(() => {27 throw new TypeError('foo bar baz');28 }, TypeError);29});30test('bar', t => {31 const err = t.notThrows(() => {32 throw new TypeError('foo bar baz');33 }, TypeError);34 t.is(err.message, 'foo bar baz');35});36import test from 'ava';37test('foo', async t => {38 await t.notThrowsAsync(Promise.resolve());39 await t.notThrowsAsync(Promise.reject(new TypeError('foo bar baz')), TypeError);40});41test('bar', async t => {42 const err = await t.notThrowsAsync(Promise.reject(new TypeError('foo bar baz')), TypeError);43 t.is(err.message, 'foo bar baz');44});45import test from 'ava';46test('foo', t => {47 t.pass();48});49test('bar', async t => {50 const bar = Promise.resolve('bar');51 t.is(await bar, 'bar');52});53import test from 'ava';54test.skip('will not be run', t => {55 t.fail();56});57import test from 'ava';58test.todo('will think about writing this later');59import test from 'ava';60test('foo', t => {61 t.truthy('unicorn');62});
Using AI Code Generation
1import test from 'ava';2import { AssertionError } from 'assert';3test('throws assertion error', t => {4 t.throws(() => {5 throw new AssertionError({6 });7 });8});9import test from 'ava';10import { AssertionError } from 'assert';11test('throws assertion error', t => {12 t.throws(() => {13 throw new AssertionError({14 });15 }, {16 });17});18### t.throwsAsync(asyncFn, [error, [message]])19import test from 'ava';20test('rejects', async t => {21 await t.throwsAsync(Promise.reject(new Error('foo')), Error);22 await t.throwsAsync(Promise.reject(new Error('foo')), /foo/);23 await t.throwsAsync(Promise.reject(new Error('foo')), err => err.message === 'foo');24 await t.throwsAsync(Promise.reject(new Error('foo')), {message: 'foo'});25 await t.throwsAsync(Promise.reject(new Error('foo')), {instanceOf: Error});26 await t.throwsAsync(Promise.reject(new Error('foo')), {is: Error});27 await t.throwsAsync(Promise.reject(new Error('foo')), {message: /foo/});28 await t.throwsAsync(Promise.reject(new Error('foo')), {message: err => err.message === 'foo'});29});30### t.notThrows(fn, [message])
Using AI Code Generation
1import test from 'ava';2import assert from 'assert';3test('foo', t => {4 t.throws(() => {5 assert(false);6 }, AssertionError);7});
Using AI Code Generation
1const test = require('ava');2const assert = require('assert');3test('throws', t => {4 assert.throws(() => {5 throw new Error('foo');6 }, Error);7 t.pass();8});9test('throws', t => {10 t.throws(() => {11 throw new Error('foo');12 }, Error);13});14test('throws', async t => {15 await t.throwsAsync(async () => {16 throw new Error('foo');17 }, Error);18});
Using AI Code Generation
1const test = require('ava');2test('foo', t => {3 t.throws(() => {4 foo();5 }, {instanceOf: TypeError});6});7function foo() {8 throw new TypeError('bar');9}
Using AI Code Generation
1import test from 'ava';2import fn from './';3test('main', t => {4 t.throws(fn(1), 'Expected a string, got number');5});6import test from 'ava';7test('main', t => {8 t.pass();9});10import test from 'ava';11import fn from './';12test('main', t => {13 t.is(fn('unicorns'), 'unicorns & rainbows');14});15import test from 'ava';16import fn from './';17test('main', t => {18 t.is(fn('unicorns'), 'unicorns & rainbows');19});20import test from 'ava';21import fn from './';22test('main', t => {23 t.is(fn('unicorns'), 'unicorns & rainbows');24});25import test from 'ava';26import fn from './';27test('main', t => {28 t.is(fn('unicorns'), 'unicorns & rainbows');29});30import test from 'ava';31import fn from './';32test('main', t => {33 t.is(fn('unicorns'), 'unicorns & rainbows');34});35import test from 'ava';36import fn from './';37test('main', t => {38 t.is(fn('unicorns'), 'unicorns & rainbows');39});40import test from 'ava';41import fn from './';42test('main', t => {43 t.is(fn('unicorns'), 'unicorns & rainbows');44});45import test from 'ava';46import fn from './';47test('main', t => {48 t.is(fn('unicorns'), 'unicorns & rainbows');49});50import test from 'ava';51import fn from './';52test('main', t => {53 t.is(fn('unicorns'), 'unicorns & rainbows');54});55import test from 'ava';56import fn from './';57test('main', t => {58 t.is(fn('unicorns'), 'unicorns & rainbows');59});60import test from 'ava';61import fn from './';62test('main', t => {63 t.is(fn('unicorns'), 'unicorns & rainbows');
Using AI Code Generation
1var assert = require('assert');2assert(true);3assert(1);4assert(false);5assert(0);6assert(false, 'it\'s false');7assert.deepEqual({a:1}, {a:'1'});8assert.deepEqual({a:1}, {a:1});9assert.deepEqual({a:1}, {a:'1'}, 'deepEqual fail');10assert.deepStrictEqual({a:1}, {a:'1'});11assert.deepStrictEqual({a:1}, {a:1});12assert.deepStrictEqual({a:1}, {a:'1'}, 'deepStrictEqual fail');
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!!