Best JavaScript code snippet using playwright-internal
_tokenizer.js
Source:_tokenizer.js
...4 test('clean.text not set', function(t) {5 var clean = {}; // clean.text not set6 var messages = sanitizer({}, clean);7 // no tokens produced8 t.deepEquals(clean.tokens, [], 'no tokens');9 t.deepEquals(clean.tokens_complete, [], 'no tokens');10 t.deepEquals(clean.tokens_incomplete, [], 'no tokens');11 // no errors/warnings produced12 t.deepEquals(messages.errors, [], 'no errors');13 t.deepEquals(messages.warnings, [], 'no warnings');14 t.end();15 });16 test('clean.text not a string', function(t) {17 var clean = { text: {} }; // clean.text not a string18 var messages = sanitizer({}, clean);19 // no tokens produced20 t.deepEquals(clean.tokens, [], 'no tokens');21 t.deepEquals(clean.tokens_complete, [], 'no tokens');22 t.deepEquals(clean.tokens_incomplete, [], 'no tokens');23 // no errors/warnings produced24 t.deepEquals(messages.errors, [], 'no errors');25 t.deepEquals(messages.warnings, [], 'no warnings');26 t.end();27 });28 test('empty string', function(t) {29 var clean = { text: '' };30 var messages = sanitizer({}, clean);31 // no tokens produced32 t.deepEquals(clean.tokens, [], 'no tokens');33 t.deepEquals(clean.tokens_complete, [], 'no tokens');34 t.deepEquals(clean.tokens_incomplete, [], 'no tokens');35 // no errors/warnings produced36 t.deepEquals(messages.errors, [], 'no errors');37 t.deepEquals(messages.warnings, [], 'no warnings');38 t.end();39 });40 test('clean.parsed_text set but clean.parsed_text.name invalid', function(t) {41 var clean = { parsed_text: { text: {} } };42 var messages = sanitizer({}, clean);43 // no tokens produced44 t.deepEquals(clean.tokens, [], 'no tokens');45 t.deepEquals(clean.tokens_complete, [], 'no tokens');46 t.deepEquals(clean.tokens_incomplete, [], 'no tokens');47 // no errors/warnings produced48 t.deepEquals(messages.errors, [], 'no errors');49 t.deepEquals(messages.warnings, [], 'no warnings');50 t.end();51 });52 test('favor clean.parsed_text.name over clean.text', function(t) {53 var clean = { parsed_text: { name: 'foo' }, text: 'bar' };54 var messages = sanitizer({}, clean);55 // favor clean.parsed_text.name over clean.text56 t.deepEquals(clean.tokens, [ 'foo' ], 'use clean.parsed_text.name');57 t.deepEquals(clean.tokens_complete, [ 'foo' ], 'use clean.parsed_text.name');58 t.deepEquals(clean.tokens_incomplete, [], 'no tokens');59 // no errors/warnings produced60 t.deepEquals(messages.errors, [], 'no errors');61 t.deepEquals(messages.warnings, [], 'no warnings');62 t.end();63 });64 test('favor clean.parsed_text street data over clean.text', function(t) {65 var clean = { parsed_text: { number: '190', street: 'foo st' }, text: 'bar' };66 var messages = sanitizer({}, clean);67 // favor clean.parsed_text.name over clean.text68 t.deepEquals(clean.tokens, [ '190', 'foo', 'st' ], 'use street name + number');69 t.deepEquals(clean.tokens_complete, [ '190', 'foo', 'st' ], 'use street name + number');70 t.deepEquals(clean.tokens_incomplete, [], 'no tokens');71 // no errors/warnings produced72 t.deepEquals(messages.errors, [], 'no errors');73 t.deepEquals(messages.warnings, [], 'no warnings');74 t.end();75 });76 test('favor clean.parsed_text.name over clean.parsed_text street data', function(t) {77 var clean = { parsed_text: { number: '190', street: 'foo st', name: 'foo' }, text: 'bar' };78 var messages = sanitizer({}, clean);79 // favor clean.parsed_text.name over all other variables80 t.deepEquals(clean.tokens, [ 'foo' ], 'use clean.parsed_text.name');81 t.deepEquals(clean.tokens_complete, [ 'foo' ], 'use clean.parsed_text.name');82 t.deepEquals(clean.tokens_incomplete, [], 'no tokens');83 // no errors/warnings produced84 t.deepEquals(messages.errors, [], 'no errors');85 t.deepEquals(messages.warnings, [], 'no warnings');86 t.end();87 });88};89module.exports.tests.space_delimiter = function(test, common) {90 test('space delimiter - simple', function(t) {91 var clean = { text: '30 west 26th street new york' };92 var messages = sanitizer({}, clean);93 // tokens produced94 t.deepEquals(clean.tokens, [95 '30',96 'west',97 '26th',98 'street',99 'new',100 'york'101 ], 'tokens produced');102 // all but last token marked as 'complete'103 t.deepEquals(clean.tokens_complete, [104 '30',105 'west',106 '26th',107 'street',108 'new'109 ], 'tokens produced');110 // last token marked as 'incomplete'111 t.deepEquals(clean.tokens_incomplete, [112 'york'113 ], 'tokens produced');114 // no errors/warnings produced115 t.deepEquals(messages.errors, [], 'no errors');116 t.deepEquals(messages.warnings, [], 'no warnings');117 t.end();118 });119 test('space delimiter - multiple spaces / other whitespace', function(t) {120 var clean = { text: ' 30 west \t26th \nstreet new york ' };121 var messages = sanitizer({}, clean);122 // tokens produced123 t.deepEquals(clean.tokens, [124 '30',125 'west',126 '26th',127 'street',128 'new',129 'york'130 ], 'tokens produced');131 // all but last token marked as 'complete'132 t.deepEquals(clean.tokens_complete, [133 '30',134 'west',135 '26th',136 'street',137 'new'138 ], 'tokens produced');139 // last token marked as 'incomplete'140 t.deepEquals(clean.tokens_incomplete, [141 'york'142 ], 'tokens produced');143 // no errors/warnings produced144 t.deepEquals(messages.errors, [], 'no errors');145 t.deepEquals(messages.warnings, [], 'no warnings');146 t.end();147 });148};149module.exports.tests.comma_delimiter = function(test, common) {150 test('comma delimiter - simple', function(t) {151 var clean = { text: '30 west 26th street, new york' };152 var messages = sanitizer({}, clean);153 // tokens produced154 t.deepEquals(clean.tokens, [155 '30',156 'west',157 '26th',158 'street',159 'new',160 'york'161 ], 'tokens produced');162 // all but last token marked as 'complete'163 t.deepEquals(clean.tokens_complete, [164 '30',165 'west',166 '26th',167 'street',168 'new'169 ], 'tokens produced');170 // last token marked as 'incomplete'171 t.deepEquals(clean.tokens_incomplete, [172 'york'173 ], 'tokens produced');174 // no errors/warnings produced175 t.deepEquals(messages.errors, [], 'no errors');176 t.deepEquals(messages.warnings, [], 'no warnings');177 t.end();178 });179 test('comma delimiter - multiple commas', function(t) {180 var clean = { text: ',30 west 26th street,,, new york,' };181 var messages = sanitizer({}, clean);182 // tokens produced183 t.deepEquals(clean.tokens, [184 '30',185 'west',186 '26th',187 'street',188 'new',189 'york'190 ], 'tokens produced');191 // all but last token marked as 'complete'192 t.deepEquals(clean.tokens_complete, [193 '30',194 'west',195 '26th',196 'street',197 'new'198 ], 'tokens produced');199 // last token marked as 'incomplete'200 t.deepEquals(clean.tokens_incomplete, [201 'york'202 ], 'tokens produced');203 // no errors/warnings produced204 t.deepEquals(messages.errors, [], 'no errors');205 t.deepEquals(messages.warnings, [], 'no warnings');206 t.end();207 });208};209module.exports.tests.forward_slash_delimiter = function(test, common) {210 test('forward slash delimiter - simple', function(t) {211 var clean = { text: 'Bedell Street/133rd Avenue' };212 var messages = sanitizer({}, clean);213 // tokens produced214 t.deepEquals(clean.tokens, [215 'Bedell',216 'Street',217 '133rd',218 'Avenue'219 ], 'tokens produced');220 // all but last token marked as 'complete'221 t.deepEquals(clean.tokens_complete, [222 'Bedell',223 'Street',224 '133rd'225 ], 'tokens produced');226 // last token marked as 'incomplete'227 t.deepEquals(clean.tokens_incomplete, [228 'Avenue'229 ], 'tokens produced');230 // no errors/warnings produced231 t.deepEquals(messages.errors, [], 'no errors');232 t.deepEquals(messages.warnings, [], 'no warnings');233 t.end();234 });235 test('forward slash - multiple slashes', function(t) {236 var clean = { text: '/Bedell Street//133rd Avenue/' };237 var messages = sanitizer({}, clean);238 // tokens produced239 t.deepEquals(clean.tokens, [240 'Bedell',241 'Street',242 '133rd',243 'Avenue'244 ], 'tokens produced');245 // all but last token marked as 'complete'246 t.deepEquals(clean.tokens_complete, [247 'Bedell',248 'Street',249 '133rd'250 ], 'tokens produced');251 // last token marked as 'incomplete'252 t.deepEquals(clean.tokens_incomplete, [253 'Avenue'254 ], 'tokens produced');255 // no errors/warnings produced256 t.deepEquals(messages.errors, [], 'no errors');257 t.deepEquals(messages.warnings, [], 'no warnings');258 t.end();259 });260};261module.exports.tests.final_token_single_gram = function(test, common) {262 test('final token single gram - numeric', function(t) {263 var clean = { text: 'grolmanstrasse 1' };264 var messages = sanitizer({}, clean);265 // tokens produced266 t.deepEquals(clean.tokens, [267 'grolmanstrasse',268 '1'269 ], 'tokens produced');270 // all but last token marked as 'complete'271 t.deepEquals(clean.tokens_complete, [272 'grolmanstrasse',273 ], 'tokens produced');274 // last token marked as 'incomplete'275 t.deepEquals(clean.tokens_incomplete, [276 '1'277 ], 'tokens produced');278 // no errors/warnings produced279 t.deepEquals(messages.errors, [], 'no errors');280 t.deepEquals(messages.warnings, [], 'no warnings');281 t.end();282 });283 test('final token single gram - non-numeric', function(t) {284 var clean = { text: 'grolmanstrasse a' };285 var messages = sanitizer({}, clean);286 // tokens produced287 t.deepEquals(clean.tokens, [288 'grolmanstrasse',289 'a'290 ], 'tokens produced');291 // all but last token marked as 'complete'292 t.deepEquals(clean.tokens_complete, [293 'grolmanstrasse',294 ], 'tokens produced');295 // last token marked as 'incomplete'296 t.deepEquals(clean.tokens_incomplete, [297 'a'298 ], 'tokens produced');299 // no errors/warnings produced300 t.deepEquals(messages.errors, [], 'no errors');301 t.deepEquals(messages.warnings, [], 'no warnings');302 t.end();303 });304};305module.exports.tests.back_slash_delimiter = function(test, common) {306 test('back slash delimiter - simple', function(t) {307 var clean = { text: 'Bedell Street\\133rd Avenue' };308 var messages = sanitizer({}, clean);309 // tokens produced310 t.deepEquals(clean.tokens, [311 'Bedell',312 'Street',313 '133rd',314 'Avenue'315 ], 'tokens produced');316 // no errors/warnings produced317 t.deepEquals(messages.errors, [], 'no errors');318 t.deepEquals(messages.warnings, [], 'no warnings');319 t.end();320 });321 test('back slash - multiple slashes', function(t) {322 var clean = { text: '\\Bedell Street\\\\133rd Avenue\\' };323 var messages = sanitizer({}, clean);324 // tokens produced325 t.deepEquals(clean.tokens, [326 'Bedell',327 'Street',328 '133rd',329 'Avenue'330 ], 'tokens produced');331 // no errors/warnings produced332 t.deepEquals(messages.errors, [], 'no errors');333 t.deepEquals(messages.warnings, [], 'no warnings');334 t.end();335 });336};337module.exports.tests.mixed_delimiter = function(test, common) {338 test('mixed delimiters', function(t) {339 var clean = { text: ',/Bedell Street\\, \n\t ,\\//133rd Avenue, /\n/' };340 var messages = sanitizer({}, clean);341 // tokens produced342 t.deepEquals(clean.tokens, [343 'Bedell',344 'Street',345 '133rd',346 'Avenue'347 ], 'tokens produced');348 // no errors/warnings produced349 t.deepEquals(messages.errors, [], 'no errors');350 t.deepEquals(messages.warnings, [], 'no warnings');351 t.end();352 });353};354module.exports.all = function (tape, common) {355 function test(name, testFunction) {356 return tape('sanitizeR _tokenizer: ' + name, testFunction);357 }358 for( var testCase in module.exports.tests ){359 module.exports.tests[testCase](test, common);360 }...
_city_name_standardizer.js
Source:_city_name_standardizer.js
...8 };9 const expected_clean = {10 };11 const messages = sanitizer(raw, clean);12 t.deepEquals(clean, expected_clean);13 t.deepEquals(messages.errors, [], 'no errors');14 t.deepEquals(messages.warnings, [], 'no warnings');15 t.end();16 });17 test('undefined parsed_text.city should be unchanged', function(t) {18 const raw = {};19 const clean = {20 parsed_text: {21 address: 'address value',22 city: undefined23 }24 };25 const expected_clean = {26 parsed_text: {27 address: 'address value',28 city: undefined29 }30 };31 const messages = sanitizer(raw, clean);32 t.deepEquals(clean, expected_clean);33 t.deepEquals(messages.errors, [], 'no errors');34 t.deepEquals(messages.warnings, [], 'no warnings');35 t.end();36 });37 test('\'saint\' should be abbreviated to \'st\' wherever it appears in the city', function(t) {38 const raw = {};39 const clean = {40 parsed_text: {41 query: 'saint query value',42 neighbourhood: 'saint neighbourhood value',43 borough: 'saint borough value',44 city: 'SainT city sAiNt value saInt',45 county: 'saint county value',46 state: 'saint state value',47 postalcode: 'saint postalcode value',48 country: 'saint country value'49 }50 };51 const expected_clean = {52 parsed_text: {53 query: 'saint query value',54 neighbourhood: 'saint neighbourhood value',55 borough: 'saint borough value',56 city: 'st city st value st',57 county: 'saint county value',58 state: 'saint state value',59 postalcode: 'saint postalcode value',60 country: 'saint country value'61 }62 };63 const messages = sanitizer(raw, clean);64 t.deepEquals(clean, expected_clean);65 t.deepEquals(messages.errors, [], 'no errors');66 t.deepEquals(messages.warnings, [], 'no warnings');67 t.end();68 });69 test('\'sainte\' should be abbreviated to \'ste\' wherever it appears in the city', function(t) {70 const raw = {};71 const clean = {72 parsed_text: {73 query: 'sainte query value',74 neighbourhood: 'sainte neighbourhood value',75 borough: 'sainte borough value',76 city: 'SaintE city sAinTe value saINte',77 county: 'sainte county value',78 state: 'sainte state value',79 postalcode: 'sainte postalcode value',80 country: 'sainte country value'81 }82 };83 const expected_clean = {84 parsed_text: {85 query: 'sainte query value',86 neighbourhood: 'sainte neighbourhood value',87 borough: 'sainte borough value',88 city: 'ste city ste value ste',89 county: 'sainte county value',90 state: 'sainte state value',91 postalcode: 'sainte postalcode value',92 country: 'sainte country value'93 }94 };95 const messages = sanitizer(raw, clean);96 t.deepEquals(clean, expected_clean);97 t.deepEquals(messages.errors, [], 'no errors');98 t.deepEquals(messages.warnings, [], 'no warnings');99 t.end();100 });101 test('\'ft\' should be expanded to \'fort\' wherever it appears in the city', function(t) {102 const raw = {};103 const clean = {104 parsed_text: {105 query: 'ft query value',106 neighbourhood: 'ft neighbourhood value',107 borough: 'ft borough value',108 city: 'Ft city ft value fT',109 county: 'ft county value',110 state: 'ft state value',111 postalcode: 'ft postalcode value',112 country: 'ft country value'113 }114 };115 const expected_clean = {116 parsed_text: {117 query: 'ft query value',118 neighbourhood: 'ft neighbourhood value',119 borough: 'ft borough value',120 city: 'fort city fort value fort',121 county: 'ft county value',122 state: 'ft state value',123 postalcode: 'ft postalcode value',124 country: 'ft country value'125 }126 };127 const messages = sanitizer(raw, clean);128 t.deepEquals(clean, expected_clean);129 t.deepEquals(messages.errors, [], 'no errors');130 t.deepEquals(messages.warnings, [], 'no warnings');131 t.end();132 });133 test('\'mt\' should be expanded to \'mount\' wherever it appears in the city', function(t) {134 const raw = {};135 const clean = {136 parsed_text: {137 query: 'mt query value',138 neighbourhood: 'mt neighbourhood value',139 borough: 'mt borough value',140 city: 'Mt city mt value mT',141 county: 'mt county value',142 state: 'mt state value',143 postalcode: 'mt postalcode value',144 country: 'mt country value'145 }146 };147 const expected_clean = {148 parsed_text: {149 query: 'mt query value',150 neighbourhood: 'mt neighbourhood value',151 borough: 'mt borough value',152 city: 'mount city mount value mount',153 county: 'mt county value',154 state: 'mt state value',155 postalcode: 'mt postalcode value',156 country: 'mt country value'157 }158 };159 const messages = sanitizer(raw, clean);160 t.deepEquals(clean, expected_clean);161 t.deepEquals(messages.errors, [], 'no errors');162 t.deepEquals(messages.warnings, [], 'no warnings');163 t.end();164 });165 test('mixture of \'mt\', \'ft\', \'saint\', and \'sainte\' should be expanded/abbreviated', function(t) {166 const raw = {};167 const clean = {168 parsed_text: {169 city: 'mt. ft saint sainte mt ft.'170 }171 };172 const expected_clean = {173 parsed_text: {174 city: 'mount fort st ste mount fort'175 }176 };177 const messages = sanitizer(raw, clean);178 t.deepEquals(clean, expected_clean);179 t.deepEquals(messages.errors, [], 'no errors');180 t.deepEquals(messages.warnings, [], 'no warnings');181 t.end();182 });183 test('period word boundary on \'mt.\' should replace with a space', function(t) {184 const raw = {};185 const clean = {186 parsed_text: {187 city: 'mt.city'188 }189 };190 const expected_clean = {191 parsed_text: {192 city: 'mount city'193 }194 };195 const messages = sanitizer(raw, clean);196 t.deepEquals(clean, expected_clean);197 t.deepEquals(messages.errors, [], 'no errors');198 t.deepEquals(messages.warnings, [], 'no warnings');199 t.end();200 });201 test('period word boundary on \'ft.\' should replace with a space', function(t) {202 const raw = {};203 const clean = {204 parsed_text: {205 city: 'ft.city'206 }207 };208 const expected_clean = {209 parsed_text: {210 city: 'fort city'211 }212 };213 const messages = sanitizer(raw, clean);214 t.deepEquals(clean, expected_clean);215 t.deepEquals(messages.errors, [], 'no errors');216 t.deepEquals(messages.warnings, [], 'no warnings');217 t.end();218 });219};220module.exports.all = function (tape, common) {221 function test(name, testFunction) {222 return tape('sanitizer _city_name_standardizer: ' + name, testFunction);223 }224 for( const testCase in module.exports.tests ){225 module.exports.tests[testCase](test, common);226 }...
test.js
Source:test.js
...19 t.equals(day1.sumFuel([12, 1969, 14]), 660)20 t.end()21})22tap.test('day2', async t => {23 t.deepEquals(day2.run([1,0,0,0,99], 0), [2,0,0,0,99])24 t.deepEquals(day2.run([2,3,0,3,99], 0), [2,3,0,6,99])25 t.deepEquals(day2.run([2,4,4,5,99,0], 0), [2,4,4,5,99,9801])26 t.deepEquals(day2.run([1,1,1,4,99,5,6,0,99], 0), [30,1,1,4,2,5,6,0,99])27 t.deepEquals(day2.run([1,9,10,3,2,3,11,0,99,30,40,50], 0), [3500,9,10,70,2,3,11,0,99,30,40,50])28 t.end()29})30tap.test('day3', async t => {31 t.deepEquals(day3.parse('R75'), { direction: 'R', length: 75})32 t.deepEquals(day3.distance(['R8','U5','L5','D3'],33 ['U7','R6','D4','L4']), '6 30')34 t.deepEquals(day3.distance(['R75','D30','R83','U83','L12','D49','R71','U7','L72'],35 ['U62','R66','U55','R34','D71','R55','D58','R83']), '159 610')36 t.deepEquals(day3.distance(['R98','U47','R26','D63','R33','U87','L62','D20','R33','U53','R51'],37 ['U98','R91','D20','R16','D67','R40','U7','R15','U6','R7']), '135 410')38 t.end()39})40tap.test('day4', async t => {41 t.equals(day4.criteria(122345), true)42 t.equals(day4.criteria(12234), false)43 t.equals(day4.criteria(1223445), false)44 t.equals(day4.criteria(111111), true)45 t.equals(day4.criteria(135679), false)46 t.equals(day4.criteria(111123), true)47 t.equals(day4.criteria(223450), false)48 t.equals(day4.criteria(123789), false)49 t.equals(day4.analyze(234560,234600), 4)50 t.equals(day4.criteria(112233), true)51 t.equals(day4.criteria2(123444), false)52 t.equals(day4.criteria2(111122), true)53 t.end()54})55tap.test('intcode lib', async t => {56 t.deepEquals(intcode.run([1,0,0,0,99], [0]), [2,0,0,0,99])57 t.deepEquals(intcode.run([2,3,0,3,99], [0]), [2,3,0,6,99])58 t.deepEquals(intcode.run([2,4,4,5,99,0], [0]), [2,4,4,5,99,9801])59 t.deepEquals(intcode.run([1,1,1,4,99,5,6,0,99], [0]), [30,1,1,4,2,5,6,0,99])60 t.deepEquals(intcode.run([1,9,10,3,2,3,11,0,99,30,40,50], [0]), [3500,9,10,70,2,3,11,0,99,30,40,50])61 //day562 //t.deepEquals(intcode.run([3,0,99]), [5,0,99])63 t.deepEquals(intcode.run([1002,4,3,4,33]), [1002, 4, 3, 4, 99])64 t.deepEquals(intcode.run([1101,100,-1,4,0]), [1101,100,-1,4,99])65 t.deepEquals(intcode.run([3,9,8,9,10,9,4,9,99,-1,8], [8], true), 1)66 t.deepEquals(intcode.run([3,9,8,9,10,9,4,9,99,-1,8], [9], true), 0)67 t.deepEquals(intcode.run([3,9,7,9,10,9,4,9,99,-1,8], [7], true), 1)68 t.deepEquals(intcode.run([3,9,7,9,10,9,4,9,99,-1,8], [8], true), 0)69 t.deepEquals(intcode.run([3,3,1108,-1,8,3,4,3,99], [8], true), 1)70 t.deepEquals(intcode.run([3,3,1108,-1,8,3,4,3,99], [7], true), 0)71 t.deepEquals(intcode.run([3,3,1107,-1,8,3,4,3,99], [7], true), 1)72 t.deepEquals(intcode.run([3,3,1107,-1,8,3,4,3,99], [8], true), 0)73 t.deepEquals(intcode.run([3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9], [0], true), 0)74 t.deepEquals(intcode.run([3,12,6,12,15,1,13,14,13,4,13,99,-1,0,1,9], [1], true), 1)75 t.deepEquals(intcode.run([3,3,1105,-1,9,1101,0,0,12,4,12,99,1], [0], true), 0)76 t.deepEquals(intcode.run([3,3,1105,-1,9,1101,0,0,12,4,12,99,1], [1], true), 1)77 t.deepEquals(intcode.run([109,1,204,-1,1001,100,1,100,1008,100,16,101,1006,101,0,99], [], true), 109)78 t.deepEquals(intcode.run([1102,34915192,34915192,7,4,7,99,0], [0], true), 1219070632396864)79 t.deepEquals(intcode.run([104,1125899906842624,99], [0], true), 1125899906842624)80 81 //operator parsing82 t.deepEquals(intcode.parseOperator(1002), { op: 2, params: ['P', 'I', 'P']})83 t.deepEquals(intcode.parseOperator(102), { op: 2, params: ['I', 'P', 'P']})84 t.deepEquals(intcode.parseOperator(2), { op: 2, params: ['P', 'P', 'P']})85 t.deepEquals(intcode.parseOperator(04), { op: 4, params: ['P']})86 t.deepEquals(intcode.parseOperator(104), { op: 4, params: ['I']})87 t.deepEquals(intcode.parseOperator(107), { op: 7, params: ['I', 'P', 'P']})88 t.deepEquals(intcode.parseOperator(07), { op: 7, params: ['P', 'P', 'P']})89 t.deepEquals(intcode.parseOperator(7), { op: 7, params: ['P', 'P', 'P']})90 t.deepEquals(intcode.parseOperator(1107), { op: 7, params: ['I', 'I', 'P']})91 t.deepEquals(intcode.parseOperator(5), { op: 5, params: ['P', 'P']})92 t.deepEquals(intcode.parseOperator(105), { op: 5, params: ['I', 'P']})93 t.deepEquals(intcode.parseOperator(1105), { op: 5, params: ['I', 'I']})94 t.deepEquals(intcode.parseOperator(205), { op: 5, params: ['R', 'P']})95 t.end()96})97tap.test('day5', async t => {98 //t.equals([3,0,4,0,99], '')99 t.end()100})101tap.test('day6', async t => {102 //t.equals(day6.sumOrbits(['B)A']), 1)103 //t.equals(day6.sumOrbits(['B)A', 'D)E']), 2)104 //t.equals(day6.sumOrbits(['B)A', 'C)B']), 3)105 t.equals(day6.sumOrbits(['COM)B', 'B)C','C)D', 'D)E', 'E)F', 'B)G', 'G)H', 'D)I', 'E)J', 'J)K', 'K)L']), 42)106 t.end()107})108tap.test('day7', async t => {109 t.deepEquals(day7.permutator([]), [[]])110 t.deepEquals(day7.permutator([1]), [[1]])111 t.deepEquals(day7.permutator([1, 2]), [[1, 2], [2, 1]])112 t.deepEquals(day7.permutator([1, 2, 3]), [ [1, 2, 3], [1, 3, 2], [2, 1, 3], [2, 3, 1], [3, 1, 2], [3, 2, 1]])113 t.equals(day7.testAmplifiers([3,15,3,16,1002,16,10,16,1,16,15,15,4,15,99,0,0]), 43210)114 t.equals(day7.testAmplifiers([3,23,3,24,1002,24,10,24,1002,23,-1,23,101,5,23,23,1,24,23,23,4,23,99,0,0]), 54321)115 //t.equals(day7.feedbackLoop([3,26,1001,26,-4,26,3,27,1002,27,2,27,1,27,26,27,4,27,1001,28,-1,28,1005,28,6,99,0,0,5]), 139629729)116 t.end()117})118tap.test('day8', async t => {119 t.deepEquals(day8.findLayers('123456789012', 3, 2), [['123', '456'], ['789', '012']])120 t.equals(day8.decode('0222112222120000', 2, 2), '\u2b1b\u2b1c\n\u2b1c\u2b1b\n')121 t.end()122})123tap.test('day9', async t => {124 t.equals(true, true)125 t.end()126})127tap.test('day10', async t => {128 const ex1 = readAsteroidFile('./test/data/day10-1.txt')129 //t.equals(day10.bestLocation(ex1), 8)130 const ex2 = readAsteroidFile('./test/data/day10-2.txt')131 //t.equals(day10.bestLocation(ex2), 33)132 const ex3 = readAsteroidFile('./test/data/day10-3.txt')133// t.equals(day10.bestLocation(ex3), 35)...
prune-pojo.js
Source:prune-pojo.js
...41 });42 it('even gives the predicate a path to work with', function() {43 expect(44 prunePOJO(45 (x, path) => !deepEquals(path, ['x', 'y']),46 {47 x: { y: 3 },48 z: true49 }))50 .to.eql({51 z: true52 });53 expect(54 prunePOJO(55 (x, path) => !deepEquals(path, ['x', 'y']),56 {57 x: { y: { z: 3 } },58 z: true59 }))60 .to.eql({61 z: true62 });63 expect(64 prunePOJO(65 (x, path) => !deepEquals(path, ['x', 'y']),66 {67 x: { y: [3] },68 z: true69 }))70 .to.eql({71 z: true72 });73 let pathPredicate = (x, path) => !(74 deepEquals(path, ['a']) ||75 deepEquals(path, ['b', 'c']) ||76 deepEquals(path, ['c', 'a', 1])77 );78 expect(pathPredicate(true, ['b', 'c'])).to.be.false;79 expect(pathPredicate('foo', ['b', 'd'])).to.be.true;80 81 expect(82 prunePOJO(83 pathPredicate,84 {85 a: 3,86 b: { c: true, d: 'foo' },87 c: { a: [0, 4, null] },88 }))89 .to.eql({90 b: { d: 'foo' },91 c: { a: [0, null] },92 });93 });94});95describe('coprunePOJO', function() {96 it('gives the expected results', function() {97 expect(coprunePOJO(x => !!x, {98 a: null,99 b: false,100 c: undefined,101 d: NaN,102 e: 'foo',103 f: '',104 g: [],105 h: [0.0, 1.0, 'bar', { a: null, e: 'h', f: { } }],106 i: { x: { x: { y: [], z: { } } } }107 }, {108 e: 'baz',109 h: [8.0, 'bletch', { e: undefined }],110 })).to.eql({111 a: null,112 b: false,113 c: undefined,114 d: NaN,115 e: 'baz',116 f: '',117 g: [],118 h: [0.0, 8.0, 'bletch', { a: null, e: undefined, f: { } }],119 i: { x: { x: { y: [], z: { } } } }120 });121 let tc2predicate = (x, path) =>122 !(x === null || 123 deepEquals(path, ['d',1]) || 124 deepEquals(path, ['c']) || 125 deepEquals(path, ['e',0,'a']) || 126 deepEquals(path, ['f',0,'a']));127 let tc2original = {128 a: null,129 b: [null, null, { a: null, x: 3, y: true, z: undefined }, 13],130 c: { a: 5, b: 7 },131 d: [0, 5, null],132 e: [{ a: { z: 8 }, b: 7 }, 13],133 f: [{ a: 8, b: 7 }, 13],134 };135 let tc2pruned = {136 b: [{ x: 'x', y: true, z: undefined }, 'b'],137 d: [NaN],138 e: [{ b: 'a' }, null],139 f: [{ b: 7 }, 13],140 }141 expect(coprunePOJO(tc2predicate, tc2original, tc2pruned)).to.eql({142 a: null,143 b: [null, null, { a: null, x: 'x', y: true, z: undefined }, 'b'],144 c: { a: 5, b: 7 },145 d: [NaN, 5, null],146 e: [{ a: { z: 8 }, b: 'a' }, null],147 f: [{ a: 8, b: 7 }, 13],148 });149 });150});151const testPojos = [152 4,153 undefined,154 NaN,155 [],156 {},157 [0],158 [[]],159 [[[]]],160 { x: null },161 { x: undefined },162 { x: { x: { } } },163 { y: [0, "foo", { y: true, a: [] }], b: undefined, a: [5.52, [1.0, [], 2.0], 0.004], c: -0.0 },164];165const testPredicates = [166 x => !!x,167 x => true,168 x => false,169 x => x === null,170 x => typeof x === 'string',171 (x, path) => deepEquals(path, ['x']),172 (x, path) => deepEquals(path, ['y', 0]),173 (x, path) => deepEquals(path, ['y', 1]),174];175describe('prunePOJO and coprunePOJO', function() {176 it('behave like inverses of each other', function() {177 testPredicates.forEach(function(predicate) {178 testPojos.forEach(function(pojo) {179 let pruned = prunePOJO(predicate, pojo);180 let copruned = coprunePOJO(predicate, pojo, pruned);181 expect(copruned).to.eql(pojo);182 });183 });184 });...
test-json.js
Source:test-json.js
...29 });30 describe('deepEquals', () => {31 it('should throw on non-finite depth arg', () => {32 expect(() => {33 deepEquals({}, {}, Number.POSITIVE_INFINITY);34 }).to.throw(/Invalid depth/);35 });36 it('should handle null and empty objects', () => {37 expect(deepEquals(null, null)).to.be.true;38 expect(deepEquals({}, {})).to.be.true;39 expect(deepEquals({}, null)).to.be.false;40 expect(deepEquals([], [])).to.be.true;41 expect(deepEquals([], null)).to.be.false;42 });43 it('should check strict equality', () => {44 expect(deepEquals({x: 1}, {x: 1})).to.be.true;45 expect(deepEquals({x: false}, {x: false})).to.be.true;46 expect(deepEquals({x: 'abc'}, {x: 'abc'})).to.be.true;47 expect(deepEquals({x: ''}, {x: false})).to.be.false;48 expect(deepEquals({x: false}, {x: ''})).to.be.false;49 expect(deepEquals({x: ''}, {x: 0})).to.be.false;50 expect(deepEquals({x: 0}, {x: ''})).to.be.false;51 expect(deepEquals({x: 1}, {x: true})).to.be.false;52 expect(deepEquals({x: true}, {x: 1})).to.be.false;53 expect(deepEquals({x: 1}, {x: '1'})).to.be.false;54 expect(deepEquals({x: '1'}, {x: 1})).to.be.false;55 expect(deepEquals({x: undefined}, {x: null})).to.be.false;56 expect(deepEquals({x: null}, {x: undefined})).to.be.false;57 expect(deepEquals({x: {}}, {x: '[object Object]'})).to.be.false;58 expect(deepEquals({x: '[object Object]'}, {x: {}})).to.be.false;59 });60 it('should check deep equality in nested arrays and objects', () => {61 expect(deepEquals({x: {y: 1}}, {x: {y: 1}})).to.be.true;62 expect(deepEquals({x: {y: 1}}, {x: {}})).to.be.false;63 expect(deepEquals({x: {y: 1}}, {x: {y: 0}})).to.be.false;64 expect(deepEquals({x: {y: 1}}, {x: {y: 1, z: 2}})).to.be.false;65 expect(deepEquals({x: [1, 2, 3]}, {x: [1, 2, 3]})).to.be.true;66 expect(deepEquals({x: [1, 2, 3]}, {x: []})).to.be.false;67 expect(deepEquals({x: [1, 2, 3]}, {x: [1, 2, 3, 4]})).to.be.false;68 expect(deepEquals([1, 2, [3, 4]], [1, 2, [3, 4]])).to.be.true;69 expect(deepEquals([1, 2, []], [1, 2, []])).to.be.true;70 expect(deepEquals([1, 2, [3, 4]], [1, 2, [3, 4, 5]])).to.be.false;71 });72 it('should check array order', () => {73 expect(deepEquals([1, 2], [2, 1])).to.be.false;74 expect(deepEquals([1, 2, [3, 4]], [1, 2, [4, 3]])).to.be.false;75 });76 it('should not check object key order', () => {77 expect(deepEquals({x: 1, y: 2, z: 3}, {y: 2, z: 3, x: 1})).to.be.true;78 });79 it('should stop diving once depth arg is exceeded', () => {80 let depth = 0;81 expect(deepEquals(1, 1, depth)).to.be.true;82 expect(deepEquals('a', 'a', depth)).to.be.true;83 expect(deepEquals([], [], depth)).to.be.false;84 expect(deepEquals({}, {}, depth)).to.be.false;85 depth = 1;86 expect(deepEquals({x: 1}, {x: 1}, depth)).to.be.true;87 expect(deepEquals([1, 2], [1, 2], depth)).to.be.true;88 expect(deepEquals({x: {y: 1}}, {x: {y: 1}}, depth)).to.be.false;89 expect(deepEquals({x: []}, {x: []}, depth)).to.be.false;90 });91 });...
test-parseQueryString.js
Source:test-parseQueryString.js
...3var parseQueryString = require("../../querystring/parse")4o.spec("parseQueryString", function() {5 o("works", function() {6 var data = parseQueryString("?aaa=bbb")7 o(data).deepEquals({aaa: "bbb"})8 })9 o("parses empty string", function() {10 var data = parseQueryString("")11 o(data).deepEquals({})12 })13 o("parses flat object", function() {14 var data = parseQueryString("?a=b&c=d")15 o(data).deepEquals({a: "b", c: "d"})16 })17 o("handles escaped values", function() {18 var data = parseQueryString("?%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23=%3B%3A%40%26%3D%2B%24%2C%2F%3F%25%23")19 o(data).deepEquals({";:@&=+$,/?%#": ";:@&=+$,/?%#"})20 })21 o("handles escaped slashes followed by a number", function () {22 var data = parseQueryString("?hello=%2Fen%2F1")23 o(data.hello).equals("/en/1")24 })25 o("handles escaped square brackets", function() {26 var data = parseQueryString("?a%5B%5D=b")27 o(data).deepEquals({"a": ["b"]})28 })29 o("handles escaped unicode", function() {30 var data = parseQueryString("?%C3%B6=%C3%B6")31 o(data).deepEquals({"ö": "ö"})32 })33 o("handles unicode", function() {34 var data = parseQueryString("?ö=ö")35 o(data).deepEquals({"ö": "ö"})36 })37 o("parses without question mark", function() {38 var data = parseQueryString("a=b&c=d")39 o(data).deepEquals({a: "b", c: "d"})40 })41 o("parses nested object", function() {42 var data = parseQueryString("a[b]=x&a[c]=y")43 o(data).deepEquals({a: {b: "x", c: "y"}})44 })45 o("parses deep nested object", function() {46 var data = parseQueryString("a[b][c]=x&a[b][d]=y")47 o(data).deepEquals({a: {b: {c: "x", d: "y"}}})48 })49 o("parses nested array", function() {50 var data = parseQueryString("a[0]=x&a[1]=y")51 o(data).deepEquals({a: ["x", "y"]})52 })53 o("parses deep nested array", function() {54 var data = parseQueryString("a[0][0]=x&a[0][1]=y")55 o(data).deepEquals({a: [["x", "y"]]})56 })57 o("parses deep nested object in array", function() {58 var data = parseQueryString("a[0][c]=x&a[0][d]=y")59 o(data).deepEquals({a: [{c: "x", d: "y"}]})60 })61 o("parses deep nested array in object", function() {62 var data = parseQueryString("a[b][0]=x&a[b][1]=y")63 o(data).deepEquals({a: {b: ["x", "y"]}})64 })65 o("parses array without index", function() {66 var data = parseQueryString("a[]=x&a[]=y&b[]=w&b[]=z")67 o(data).deepEquals({a: ["x", "y"], b: ["w", "z"]})68 })69 o("casts booleans", function() {70 var data = parseQueryString("a=true&b=false")71 o(data).deepEquals({a: true, b: false})72 })73 o("does not cast numbers", function() {74 var data = parseQueryString("a=1&b=-2.3&c=0x10&d=1e2&e=Infinity")75 o(data).deepEquals({a: "1", b: "-2.3", c: "0x10", d: "1e2", e: "Infinity"})76 })77 o("does not cast NaN", function() {78 var data = parseQueryString("a=NaN")79 o(data.a).equals("NaN")80 })81 o("does not casts Date", function() {82 var data = parseQueryString("a=1970-01-01")83 o(typeof data.a).equals("string")84 o(data.a).equals("1970-01-01")85 })86 o("does not cast empty string to number", function() {87 var data = parseQueryString("a=")88 o(data).deepEquals({a: ""})89 })90 o("does not cast void to number", function() {91 var data = parseQueryString("a")92 o(data).deepEquals({a: ""})93 })...
style.js
Source:style.js
1import Test from 'blue-tape';2import { createStyleFromProps, styleReducer } from 'lib/utils/style';3Test('Creating style objects from prop: align', t => {4 t.deepEquals(createStyleFromProps({5 align: 'start'6 }), {7 display: 'flex',8 justifyContent: 'flex-start'9 });10 t.deepEquals(createStyleFromProps({11 align: 'end'12 }), {13 display: 'flex',14 justifyContent: 'flex-end'15 });16 t.deepEquals(createStyleFromProps({17 align: 'start end'18 }), {19 display: 'flex',20 justifyContent: 'flex-start',21 alignItems: 'flex-end'22 });23 t.deepEquals(createStyleFromProps({24 align: 'space-between center'25 }), {26 display: 'flex',27 justifyContent: 'space-between',28 alignItems: 'center'29 });30 t.end();31});32Test('Creating style objects from prop: alignContent', t => {33 t.deepEquals(createStyleFromProps({34 alignContent: 'start'35 }), {36 display: 'flex',37 alignContent: 'flex-start'38 });39 t.deepEquals(createStyleFromProps({40 alignContent: 'end'41 }), {42 display: 'flex',43 alignContent: 'flex-end'44 });45 t.deepEquals(createStyleFromProps({46 alignContent: 'center'47 }), {48 display: 'flex',49 alignContent: 'center'50 });51 t.end();52});53Test('Creating style objects from prop: flow', t => {54 t.deepEquals(createStyleFromProps({55 flow: 'row-reverse wrap'56 }), {57 display: 'flex',58 flexFlow: 'row-reverse wrap'59 });60 t.deepEquals(createStyleFromProps({61 flow: 'column'62 }), {63 display: 'flex',64 flexFlow: 'column'65 });66 t.end();67});68Test('Creating style objects from prop: inline', t => {69 t.deepEquals(createStyleFromProps({70 inline: false71 }), {72 display: 'flex'73 });74 t.deepEquals(createStyleFromProps({75 inline: true76 }), {77 display: 'inline-flex'78 });79 t.end();80});81Test('Creating style objects from prop: flex', t => {82 t.deepEquals(createStyleFromProps({83 flex: true84 }), {85 flex: '0 1 auto'86 }, 'should create flex shorthand from boolean value');87 t.deepEquals(createStyleFromProps({88 flex: false89 }), {90 flex: '0 0 auto'91 }, 'should create flex shorthand from boolean value');92 t.deepEquals(createStyleFromProps({93 flex: 3294 }), {95 flex: '0 1 32%'96 }, 'should convert a number to % for flex-basis in shorthand');97 t.deepEquals(createStyleFromProps({98 flex: '5 2 auto'99 }), {100 flex: '5 2 auto'101 }, 'should pass through other string values');102 t.end();103});104Test('Creating memoized syle objects', t => {105 t.deepEquals(styleReducer({106 align: 'start'107 }), {108 display: 'flex',109 justifyContent: 'flex-start'110 });111 t.deepEquals(styleReducer({112 alignContent: 'start'113 }), {114 display: 'flex',115 alignContent: 'flex-start'116 });117 t.end();...
guess.js
Source:guess.js
...4o.spec("guess", function() { // WARNING: guess mutates AI.possibleCodes (for efficiency) so an .init() call is needed to reset it5 // these are commented out, pending analysis of what canonical grading should be:6 // o("example 1", function() {7 // a.init(4, 6);8 // o(a.guess([0,0,0,0]).grade).deepEquals([0, 0, 4]);9 // o(a.guess([1,1,1,1]).grade).deepEquals([1, 0, 3]);10 // o(a.guess([2,3,4,5]).grade).deepEquals([0, 2, 2]);11 // o(a.guess([1,3,4,5]).grade).deepEquals([0, 3, 1]);12 // o(a.guess([1,1,4,5]).grade).deepEquals([0, 2, 2]);13 // o(a.guess([2,3,1,1]).grade).deepEquals([1, 1, 2]);14 // o(a.guess([0,0,1,1]).grade).deepEquals([1, 0, 3]);15 // o(a.guess([0,0,0,1]).grade).deepEquals([1, 0, 3]);16 // o(a.guess([3,3,3,1]).grade).deepEquals([2, 0, 2]);17 // o(a.guess([0,0,3,1]).grade).deepEquals([2, 0, 2]);18 // o(a.guess([4,4,3,1]).grade).deepEquals([2, 0, 2]);19 // o(a.guess([5,5,3,1]).grade).deepEquals([4, 0, 0]);20 // })21 // o("example 2", function() {22 // a.init(7,7);23 // o(a.guess([0,1,2,3,4,5,6]).grade).deepEquals([1, 4, 2]);24 // o(a.guess([4,3,2,1,0,0,0]).grade).deepEquals([1, 3, 3]);25 // o(a.guess([5,1,3,2,1,1,0]).grade).deepEquals([1, 3, 3]);26 // o(a.guess([6,5,0,3,2,2,0]).grade).deepEquals([0, 3, 4]);27 // o(a.guess([3,1,6,4,3,0,1]).grade).deepEquals([1, 4, 2]);28 // o(a.guess([2,3,4,6,4,1,1]).grade).deepEquals([2, 4, 1]);29 // o(a.guess([4,0,1,2,4,6,1]).grade).deepEquals([0, 7, 0]);30 // o(a.guess([1,1,4,6,0,4,2]).grade).deepEquals([3, 4, 0]);31 // o(a.guess([1,2,4,4,0,1,6]).grade).deepEquals([7, 0, 0]);32 // })33 o("tiny test", function() {34 a.init(1, 2);35 o(a.guess([1]).grade).deepEquals([0, 0, 1]);36 o(a.guess([0]).grade).deepEquals([1, 0, 0]);37 })38 o("tiny test 2", function() {39 a.init(1, 2);40 o(a.guess([0]).grade).deepEquals([0, 0, 1]);41 o(a.guess([1]).grade).deepEquals([1, 0, 0]);42 })43 o("tiny test 3", function() {44 a.init(2, 2);45 o(a.guess([0,1]).grade).deepEquals([1, 0, 1]);46 o(a.guess([1,1]).grade).deepEquals([0, 0, 2]);47 o(a.guess([0,0]).grade).deepEquals([2, 0, 0]);48 })...
Using AI Code Generation
1const { deepEquals } = require('@playwright/test/lib/utils/utils');2const obj1 = { a: 1, b: 2 };3const obj2 = { a: 1, b: 2 };4const obj3 = { a: 1, b: 2, c: 3 };5const obj4 = { a: 1, b: 2, c: 3 };6const obj5 = { a: 1, b: 2, c: 4 };7const obj6 = { a: 1, b: 2, c: 4 };8const obj7 = { a: 1, b: 2, c: 5 };9const obj8 = { a: 1, b: 2, c: 5 };10const obj9 = { a: 1, b: 2, c: 6 };11const obj10 = { a: 1, b: 2, c: 6 };12const obj11 = { a: 1, b: 2, c: 7 };13const obj12 = { a: 1, b: 2, c: 7 };14const obj13 = { a: 1, b: 2, c: 8 };15const obj14 = { a: 1, b: 2, c: 8 };16const obj15 = { a: 1, b: 2, c: 9 };17const obj16 = { a: 1, b: 2, c: 9 };18const obj17 = { a: 1, b: 2, c: 10 };19const obj18 = { a: 1, b: 2, c: 10 };20const obj19 = { a: 1, b: 2, c: 11 };21const obj20 = { a: 1, b: 2, c: 11 };22const obj21 = { a: 1, b: 2, c: 12 };23const obj22 = { a: 1, b: 2, c: 12 };24const obj23 = { a: 1, b: 2, c: 13 };25const obj24 = { a: 1, b: 2, c: 13 };26const obj25 = { a: 1, b:
Using AI Code Generation
1const { deepEquals } = require('playwright/lib/utils/utils');2const obj1 = {3};4const obj2 = {5};6console.log(deepEquals(obj1, obj2));
Using AI Code Generation
1const { deepEquals } = require('playwright/lib/utils/utils');2const assert = require('assert');3const actual = { a: 1, b: 2 };4const expected = { a: 1, b: 2 };5assert(deepEquals(actual, expected));6const { deepEquals } = require('playwright');7const assert = require('assert');8const actual = { a: 1, b: 2 };9const expected = { a: 1, b: 2 };10assert(deepEquals(actual, expected));
Using AI Code Generation
1const { deepEquals } = require('playwright/lib/internal/utils/utils');2const { deepEquals } = require('playwright/lib/internal/utils/utils');3const { deepEquals } = require('playwright/lib/internal/utils/utils');4const { deepEquals } = require('playwright/lib/internal/utils/utils');5const { deepEquals } = require('playwright/lib/internal/utils/utils');6const { deepEquals } = require('playwright/lib/internal/utils/utils');7const { deepEquals } = require('playwright/lib/internal/utils/utils');8const { deepEquals } = require('playwright/lib/internal/utils/utils');9const { deepEquals } = require('playwright/lib/internal/utils/utils');10const { deepEquals } = require('playwright/lib/internal/utils/utils');11const { deepEquals } = require('playwright/lib/internal/utils/utils');12const { deepEquals } = require('playwright/lib/internal/utils/utils');13const { deepEquals } = require('playwright/lib/internal/utils/utils');14const { deepEquals } = require('playwright/lib/internal/utils/utils');15const { deepEquals } = require('playwright/lib/internal/utils/utils');16const { deepEquals } = require('playwright/lib/internal/utils/utils');17const { deepEquals } = require('playwright/lib/internal/utils/utils');18const { deepEquals } = require('playwright/lib/internal/utils/utils');19const { deepEquals } = require('playwright/lib/internal
Using AI Code Generation
1const { deepEquals } = require('playwright-core/lib/utils/utils');2const { deepEquals } = require('playwright-core/lib/utils/utils');3const a = { a: 1, b: 2 };4const b = { a: 1, b: 2 };5const c = { a: 1, b: 2, c: 3 };6const d = { a: 1, b: 2, c: 3, d: 4 };7const e = { a: 1, b: 2, c: 3, d: 4, e: 5 };8console.log(deepEquals(a, b));9console.log(deepEquals(a, c));10console.log(deepEquals(a, d));11console.log(deepEquals(a, e));12console.log(deepEquals(b, c));13console.log(deepEquals(b, d));14console.log(deepEquals(b, e));15console.log(deepEquals(c, d));16console.log(deepEquals(c, e));17console.log(deepEquals(d, e));18console.log(deepEquals(a, a));19console.log(deepEquals(b, b));20console.log(deepEquals(c, c));21console.log(deepEquals(d, d));22console.log(deepEquals(e, e));23console.log(deepEquals(a, a, 0));24console.log(deepEquals(b, b, 0));25console.log(deepEquals(c, c, 0));26console.log(deepEquals(d, d, 0));27console.log(deepEquals(e, e, 0));28console.log(deepEquals(a, a, 1));29console.log(deepEquals(b, b, 1));30console.log(deepEquals(c, c, 1));31console.log(deepEquals(d, d, 1));32console.log(deepEquals(e, e, 1));33console.log(deepEquals(a, a, 2));34console.log(deepEquals(b, b, 2));35console.log(deepEquals(c, c, 2));36console.log(deepEquals(d, d, 2));37console.log(deepEquals(e, e, 2));38console.log(deepEquals(a, a, 3));39console.log(deepEquals(b, b, 3));40console.log(deepEquals(c, c, 3));41console.log(de
Using AI Code Generation
1const { deepEquals } = require('playwright-core/lib/utils/structs.js');2const { deepEquals } = require('playwright-core/lib/utils/structs.js');3const { deepEquals } = require('playwright-core/lib/utils/structs.js');4const { deepEquals } = require('playwright-core/lib/utils/structs.js');5const { deepEquals } = require('playwright-core/lib/utils/structs.js');6const { deepEquals } = require('playwright-core/lib/utils/structs.js');7const { deepEquals } = require('playwright-core/lib/utils/structs.js');8const { deepEquals } = require('playwright-core/lib/utils/structs.js');9const { deepEquals } = require('playwright-core/lib/utils/structs.js');10const { deepEquals } = require('playwright-core/lib/utils/structs.js');11const { deepEquals } = require('playwright-core/lib/utils/structs.js');12const { deepEquals } = require('playwright-core/lib/utils/structs.js');13const { deepEquals } = require('playwright-core/lib/utils/structs.js');14const { deepEquals } = require('playwright-core/lib/utils/structs.js');15const { deepEquals } = require('playwright-core/lib/utils/structs.js');16const { deepEquals } = require('playwright-core/lib/utils/structs.js');17const { deepEquals } = require('playwright-core/lib/utils/structs.js');
Using AI Code Generation
1const { deepEquals } = require('playwright/lib/utils/utils');2const { expect } = require('chai');3const actual = {4};5const expected = {6};7expect(deepEquals(actual, expected)).to.equal(true);8const { deepEquals } = require('playwright');9const { expect } = require('chai');10const actual = {11};12const expected = {13};14expect(deepEquals(actual, expected)).to.equal(true);15const { deepEquals } = require('playwright');16const { expect } = require('chai');17const actual = {18};19const expected = {20};21expect(deepEquals(actual, expected)).to.equal(true);22const { deepEquals } = require('playwright');23const { expect } = require('chai');24const actual = {25};26const expected = {27};28expect(deepEquals(actual, expected)).to.equal(true);29const { deepEquals } = require('playwright');30const { expect } = require('chai');31const actual = {32};33const expected = {34};35expect(deepEquals(actual, expected)).to.equal(true);36const { deepEquals } = require('playwright');37const { expect }
Using AI Code Generation
1const { deepEquals } = require("playwright-core/lib/utils/utils");2const { deepEquals } = require("playwright/lib/utils/utils");3const obj1 = { a: 1, b: 2 };4const obj2 = { a: 1, b: 2 };5const obj3 = { a: 1, b: 3 };6const result1 = deepEquals(obj1, obj2);7const result2 = deepEquals(obj1, obj3);
LambdaTest’s Playwright tutorial will give you a broader idea about the Playwright automation framework, its unique features, and use cases with examples to exceed your understanding of Playwright testing. This tutorial will give A to Z guidance, from installing the Playwright framework to some best practices and advanced concepts.
Get 100 minutes of automation test minutes FREE!!