How to use parseString method in autotest

Best Python code snippet using autotest_python

parseString.js

Source:parseString.js Github

copy

Full Screen

...4const { createFormat } = require('../dist');56describe('parseString', () => {7 it('Case #1', () => {8 const itemObject = parseString(9 'Cool Killstreak Aqua Marine Rocket Launcher (Battle Scarred)'10 );1112 assert.deepEqual(itemObject, {13 name: 'Rocket Launcher',14 craftable: true,15 killstreak: 'Killstreak',16 wear: 'Battle Scarred',17 texture: 'Aqua Marine',18 effect: 'Cool',19 quality: 'Unusual',20 });21 });2223 it('Case #2', () => {24 const itemObject = parseString(25 "Strange High Roller's Rocket Launcher (Factory New)"26 );2728 assert.deepEqual(itemObject, {29 name: 'Rocket Launcher',30 craftable: true,31 wear: 'Factory New',32 texture: "High Roller's",33 quality: 'Strange',34 });35 });3637 it('Case #3', () => {38 const itemObject = parseString(39 "Collector's Battalion's Backup Chemistry Set"40 );4142 assert.deepEqual(itemObject, {43 name: 'Chemistry Set',44 craftable: true,45 output: "Battalion's Backup",46 outputQuality: "Collector's",47 quality: 'Unique',48 });49 });5051 it('Case #4', () => {52 const itemObject = parseString(53 'Strange Festivized Professional Killstreak Australium Scattergun'54 );5556 assert.deepEqual(itemObject, {57 name: 'Scattergun',58 craftable: true,59 australium: true,60 festivized: true,61 killstreak: 'Professional Killstreak',62 quality: 'Strange',63 });64 });6566 it('Case #5', () => {67 const itemObject = parseString('Demonflame Modest Pile of Hat');6869 assert.deepEqual(itemObject, {70 name: 'Modest Pile of Hat',71 craftable: true,72 effect: 'Demonflame',73 quality: 'Unusual',74 });75 });7677 it('Case #6', () => {78 const itemObject = parseString('Strange Omniscient Orb Balloonihoodie');7980 assert.deepEqual(itemObject, {81 name: 'Balloonihoodie',82 craftable: true,83 effect: 'Omniscient Orb',84 quality: 'Unusual',85 elevated: true,86 });87 });8889 it('Case #7', () => {90 const itemObject = parseString(91 'Non-Craftable Specialized Killstreak Gunboats Kit Fabricator'92 );9394 assert.deepEqual(itemObject, {95 name: 'Specialized Killstreak Kit Fabricator',96 craftable: false,97 killstreak: 'Specialized Killstreak',98 target: 'Gunboats',99 quality: 'Unique',100 });101 });102103 it('Case #8', () => {104 const itemObject = parseString('Archimedes Strangifier Chemistry Set');105106 assert.deepEqual(itemObject, {107 name: 'Chemistry Set',108 craftable: true,109 target: 'Archimedes',110 output: 'Strangifier',111 outputQuality: 'Unique',112 quality: 'Unique',113 });114 });115116 it('Case #9', () => {117 const itemObject = parseString('Strange Backwards Ballcap');118119 assert.deepEqual(itemObject, {120 name: 'Backwards Ballcap',121 craftable: true,122 quality: 'Strange',123 });124 });125126 it('Case #10', () => {127 const itemObject = parseString(128 'Professional Killstreak Iron Curtain Kit Fabricator'129 );130131 assert.deepEqual(itemObject, {132 name: 'Professional Killstreak Kit Fabricator',133 craftable: true,134 killstreak: 'Professional Killstreak',135 target: 'Iron Curtain',136 quality: 'Unique',137 });138 });139140 it('Case #11', () => {141 const itemObject = parseString(142 'Strange Professional Killstreak Festive Grenade Launcher'143 );144145 assert.deepEqual(itemObject, {146 name: 'Festive Grenade Launcher',147 craftable: true,148 killstreak: 'Professional Killstreak',149 quality: 'Strange',150 });151 });152153 it('Case #12', () => {154 const itemObject = parseString('Strange Unique Sniper Rifle');155156 assert.deepEqual(itemObject, {157 name: 'Sniper Rifle',158 craftable: true,159 quality: 'Unique',160 elevated: true,161 });162 });163164 it('Case #13', () => {165 const itemObject = parseString('Australium Gold');166167 assert.deepEqual(itemObject, {168 name: 'Australium Gold',169 craftable: true,170 quality: 'Unique',171 });172 });173174 it('Case #14', () => {175 const itemObject = parseString('Blue Moon Case #118');176177 assert.deepEqual(itemObject, {178 name: 'Blue Moon Case',179 craftable: true,180 itemNumber: { type: 'crate', value: 118 },181 quality: 'Unique',182 });183 });184185 it('Case #15', () => {186 const itemObject = parseString('Hat #25');187188 assert.deepEqual(itemObject, {189 name: 'Hat',190 craftable: true,191 itemNumber: { type: 'craft', value: 25 },192 quality: 'Unique',193 });194 });195196 it('Case #16', () => {197 const itemObject = parseString('The Tartan Shade');198199 assert.deepEqual(itemObject, {200 name: 'Tartan Shade',201 craftable: true,202 quality: 'Unique',203 isUniqueHat: true,204 });205 });206207 it('Case #17', () => {208 const itemObject = parseString('Strange Cool Breeze');209210 assert.deepEqual(itemObject, {211 name: 'Cool Breeze',212 craftable: true,213 quality: 'Strange',214 });215 });216217 it('Case #18', () => {218 const itemObject = parseString('Strange Hot Case');219220 assert.deepEqual(itemObject, {221 name: 'Hot Case',222 craftable: true,223 quality: 'Strange',224 });225 });226227 it('Case #18', () => {228 const itemObject = parseString('Strange Hot Heels');229230 assert.deepEqual(itemObject, {231 name: 'Hot Heels',232 craftable: true,233 quality: 'Strange',234 });235 });236237 it('Case #19', () => {238 const itemObject = parseString('Strange A Head Full of Hot Air');239240 assert.deepEqual(itemObject, {241 name: 'A Head Full of Hot Air',242 craftable: true,243 quality: 'Strange',244 });245 });246247 it('Case #20', () => {248 const itemObject = parseString('Strange Vintage Tyrolean');249250 assert.deepEqual(itemObject, {251 name: 'Vintage Tyrolean',252 quality: 'Strange',253 craftable: true,254 });255 });256257 it('Case #21', () => {258 const itemObject = parseString('Strange Vintage Vintage Tyrolean');259260 assert.deepEqual(itemObject, {261 name: 'Vintage Tyrolean',262 quality: 'Vintage',263 elevated: true,264 craftable: true,265 });266 });267268 it('Case #22', () => {269 const itemObject = parseString('Vintage Tyrolean');270271 assert.deepEqual(itemObject, {272 name: 'Vintage Tyrolean',273 quality: 'Unique',274 craftable: true,275 });276 });277278 it('Case #23', () => {279 const itemObject = parseString('Vintage Vintage Tyrolean');280281 assert.deepEqual(itemObject, {282 name: 'Vintage Tyrolean',283 quality: 'Vintage',284 craftable: true,285 });286 });287288 it('Case #24', () => {289 const itemObject = parseString('Strange Haunted Hat');290291 assert.deepEqual(itemObject, {292 name: 'Haunted Hat',293 quality: 'Strange',294 craftable: true,295 });296 });297298 it('Case #25', () => {299 const itemObject = parseString('Strange Haunted Haunted Hat');300301 assert.deepEqual(itemObject, {302 name: 'Haunted Hat',303 quality: 'Haunted',304 elevated: true,305 craftable: true,306 });307 });308309 it('Case #26', () => {310 const itemObject = parseString('Haunted Hat');311312 assert.deepEqual(itemObject, {313 name: 'Haunted Hat',314 quality: 'Unique',315 craftable: true,316 });317 });318319 it('Case #27', () => {320 const itemObject = parseString('Haunted Haunted Hat');321322 assert.deepEqual(itemObject, {323 name: 'Haunted Hat',324 quality: 'Haunted',325 craftable: true,326 });327 });328329 it('Case #28', () => {330 const itemObject = parseString(331 'Eerie Orbiting Fire Condor Cap',332 false,333 false334 );335336 assert.deepEqual(itemObject, {337 name: 'Condor Cap',338 quality: 'Unusual',339 effect: 'Eerie Orbiting Fire',340 craftable: true,341 });342 });343344 it('Case #29', () => {345 const itemObject = parseString(346 'Haunted Ghosts War Paint (Battle Scarred)',347 false,348 false349 );350351 assert.deepEqual(itemObject, {352 name: 'War Paint',353 quality: 'Decorated Weapon',354 texture: 'Haunted Ghosts',355 craftable: true,356 wear: 'Battle Scarred',357 });358 });359360 it('Case #30', () => {361 const itemObject = parseString(362 'Spellbound Aspect Taunt: Most Wanted',363 false,364 false365 );366367 assert.deepEqual(itemObject, {368 name: 'Taunt: Most Wanted',369 quality: 'Unusual',370 effect: 'Spellbound Aspect',371 craftable: true,372 });373 });374375 it('Case #31', () => {376 const itemObject = parseString(377 'Haunted Phantasm Jr Bonk Boy',378 false,379 false380 );381382 assert.deepEqual(itemObject, {383 name: 'Bonk Boy',384 quality: 'Unusual',385 effect: 'Haunted Phantasm Jr',386 craftable: true,387 });388 });389390 it('Case #32', () => {391 const itemObject = parseString(392 'Ghastly Ghosts Jr Bonk Boy',393 false,394 false395 );396397 assert.deepEqual(itemObject, {398 name: 'Bonk Boy',399 quality: 'Unusual',400 effect: 'Ghastly Ghosts Jr',401 craftable: true,402 });403 });404405 it('Case #33', () => {406 const itemObject = parseString(407 'Haunted Ghosts Battle Boonie',408 false,409 false410 );411412 assert.deepEqual(itemObject, {413 name: 'Battle Boonie',414 quality: 'Unusual',415 effect: 'Haunted Ghosts',416 craftable: true,417 });418 });419420 it('Case #34', () => {421 const itemObject = parseString('Smoking Jacket', false, false);422423 assert.deepEqual(itemObject, {424 name: 'Smoking Jacket',425 craftable: true,426 quality: 'Unique',427 });428 });429430 it('Case #35', () => {431 const itemObject = parseString(432 'Smoking Smoking Skid Lid',433 false,434 false435 );436437 assert.deepEqual(itemObject, {438 name: 'Smoking Skid Lid',439 craftable: true,440 quality: 'Unusual',441 effect: 'Smoking',442 });443 });444445 it('Case #36', () => {446 const itemObject = parseString(447 'Purple Energy Smoking Skid Lid',448 false,449 false450 );451452 assert.deepEqual(itemObject, {453 name: 'Smoking Skid Lid',454 craftable: true,455 quality: 'Unusual',456 effect: 'Purple Energy',457 });458 });459460 it('Case #37', () => {461 const itemObject = parseString('Smoking Skid Lid', false, false);462463 assert.deepEqual(itemObject, {464 name: 'Smoking Skid Lid',465 craftable: true,466 quality: 'Unique',467 });468 });469470 it('Case #38', () => {471 const itemObject = parseString(472 'Strange Cosmetic Part: Kills',473 false,474 false475 );476477 assert.deepEqual(itemObject, {478 name: 'Strange Cosmetic Part: Kills',479 craftable: true,480 quality: 'Unique',481 });482 });483484 it('Case #39', () => {485 const itemObject = parseString('The Value of Teamwork', false, false);486487 assert.deepEqual(itemObject, {488 name: 'The Value of Teamwork',489 craftable: true,490 quality: 'Unique',491 });492 });493494 it('Case #40', () => {495 const itemObject = parseString(496 'The Essential Accessories',497 false,498 false499 );500501 assert.deepEqual(itemObject, {502 name: 'The Essential Accessories',503 craftable: true,504 quality: 'Unique',505 });506 });507508 it('Case #41', () => {509 const itemObject = parseString('Genuine Atomic Accolade', false, false);510511 assert.deepEqual(itemObject, {512 name: 'Atomic Accolade',513 craftable: true,514 quality: 'Genuine',515 });516 });517518 it('Case #42', () => {519 const itemObject = parseString('Bonk! Atomic Punch', false, false);520521 assert.deepEqual(itemObject, {522 name: 'Bonk! Atomic Punch',523 craftable: true,524 quality: 'Unique',525 });526 });527528 it('Case #43 - Item with native `The` with craft number', () => {529 const itemObject = parseString(530 'The Concealed Killer Weapons Case #93',531 false,532 false533 );534535 assert.deepEqual(itemObject, {536 name: 'The Concealed Killer Weapons Case',537 craftable: true,538 quality: 'Unique',539 itemNumber: { type: 'crate', value: 93 },540 });541 });542543 it('Case #44 - Old retired keys', () => {544 const itemObject = parseString(545 'Non-Craftable Naughty Winter Crate Key 2014',546 false,547 false548 );549550 assert.deepEqual(itemObject, {551 name: 'Naughty Winter Crate Key 2014',552 craftable: false,553 quality: 'Unique',554 });555 });556557 it('Case #45 - Munition case', () => {558 const itemObject = parseString(559 'Mann Co. Supply Munition #83',560 false,561 false562 );563564 assert.deepEqual(itemObject, {565 name: 'Mann Co. Supply Munition',566 craftable: true,567 quality: 'Unique',568 itemNumber: { value: 83, type: 'crate' },569 });570 });571572 it('Case #46 - Taunt: The Hot Wheeler', () => {573 const itemObject = parseString('Taunt: The Hot Wheeler', false, false);574575 assert.deepEqual(itemObject, {576 name: 'Taunt: The Hot Wheeler',577 craftable: true,578 quality: 'Unique',579 });580 });581});582583describe('parseString with numbers', () => {584 it('Case #1', () => {585 const itemObject = parseString(586 'Cool Killstreak Aqua Marine Rocket Launcher (Battle Scarred)',587 true,588 false589 );590591 assert.deepEqual(itemObject, {592 name: 'Rocket Launcher',593 craftable: true,594 killstreak: 1,595 wear: 5,596 texture: 57,597 effect: 703,598 quality: 5,599 });600 });601602 it('Case #2', () => {603 const itemObject = parseString(604 "Strange High Roller's Rocket Launcher (Factory New)",605 true,606 false607 );608609 assert.deepEqual(itemObject, {610 name: 'Rocket Launcher',611 craftable: true,612 wear: 1,613 texture: 79,614 quality: 11,615 });616 });617618 it('Case #3', () => {619 const itemObject = parseString(620 "Collector's Battalion's Backup Chemistry Set",621 true,622 false623 );624625 assert.deepEqual(itemObject, {626 name: 'Chemistry Set',627 craftable: true,628 output: "Battalion's Backup",629 outputQuality: 14,630 quality: 6,631 });632 });633634 it('Case #4', () => {635 const itemObject = parseString(636 'Strange Festivized Professional Killstreak Australium Scattergun',637 true,638 false639 );640641 assert.deepEqual(itemObject, {642 name: 'Scattergun',643 craftable: true,644 australium: true,645 festivized: true,646 killstreak: 3,647 quality: 11,648 });649 });650651 it('Case #5', () => {652 const itemObject = parseString(653 'Demonflame Modest Pile of Hat',654 true,655 false656 );657658 assert.deepEqual(itemObject, {659 name: 'Modest Pile of Hat',660 craftable: true,661 effect: 80,662 quality: 5,663 });664 });665666 it('Case #6', () => {667 const itemObject = parseString(668 'Strange Omniscient Orb Balloonihoodie',669 true,670 false671 );672673 assert.deepEqual(itemObject, {674 name: 'Balloonihoodie',675 craftable: true,676 effect: 120,677 quality: 5,678 elevated: true,679 });680 });681682 it('Case #7', () => {683 const itemObject = parseString(684 'Non-Craftable Specialized Killstreak Gunboats Kit Fabricator',685 true,686 false687 );688689 assert.deepEqual(itemObject, {690 name: 'Specialized Killstreak Kit Fabricator',691 craftable: false,692 killstreak: 2,693 target: 'Gunboats',694 quality: 6,695 });696 });697698 it('Case #8', () => {699 const itemObject = parseString(700 'Archimedes Strangifier Chemistry Set',701 true,702 false703 );704705 assert.deepEqual(itemObject, {706 name: 'Chemistry Set',707 craftable: true,708 target: 'Archimedes',709 output: 'Strangifier',710 outputQuality: 6,711 quality: 6,712 });713 });714715 it('Case #9', () => {716 const itemObject = parseString(717 'Strange Backwards Ballcap',718 true,719 false720 );721722 assert.deepEqual(itemObject, {723 name: 'Backwards Ballcap',724 craftable: true,725 quality: 11,726 });727 });728729 it('Case #10', () => {730 const itemObject = parseString(731 'Professional Killstreak Iron Curtain Kit Fabricator',732 true,733 false734 );735736 assert.deepEqual(itemObject, {737 name: 'Professional Killstreak Kit Fabricator',738 craftable: true,739 killstreak: 3,740 target: 'Iron Curtain',741 quality: 6,742 });743 });744745 it('Case #11', () => {746 const itemObject = parseString(747 'Strange Professional Killstreak Festive Grenade Launcher',748 true,749 false750 );751752 assert.deepEqual(itemObject, {753 name: 'Festive Grenade Launcher',754 craftable: true,755 killstreak: 3,756 quality: 11,757 });758 });759760 it('Case #12', () => {761 const itemObject = parseString(762 'Strange Unique Sniper Rifle',763 true,764 false765 );766767 assert.deepEqual(itemObject, {768 name: 'Sniper Rifle',769 craftable: true,770 quality: 6,771 elevated: true,772 });773 });774775 it('Case #13', () => {776 const itemObject = parseString('Australium Gold', true, false);777778 assert.deepEqual(itemObject, {779 name: 'Australium Gold',780 craftable: true,781 quality: 6,782 });783 });784785 it('Case #14', () => {786 const itemObject = parseString('Blue Moon Case #118', true, false);787788 assert.deepEqual(itemObject, {789 name: 'Blue Moon Case',790 craftable: true,791 itemNumber: { type: 'crate', value: 118 },792 quality: 6,793 });794 });795796 it('Case #15', () => {797 const itemObject = parseString('Hat #25', true, false);798799 assert.deepEqual(itemObject, {800 name: 'Hat',801 craftable: true,802 itemNumber: { type: 'craft', value: 25 },803 quality: 6,804 });805 });806807 it('Case #16', () => {808 const itemObject = parseString('The Tartan Shade', true, false);809810 assert.deepEqual(itemObject, {811 name: 'Tartan Shade',812 craftable: true,813 quality: 6,814 isUniqueHat: true,815 });816 });817818 it('Case #17', () => {819 const itemObject = parseString('Strange Cool Breeze', true, false);820821 assert.deepEqual(itemObject, {822 name: 'Cool Breeze',823 craftable: true,824 quality: 11,825 });826 });827828 it('Case #18', () => {829 const itemObject = parseString('Strange Hot Case', true, false);830831 assert.deepEqual(itemObject, {832 name: 'Hot Case',833 craftable: true,834 quality: 11,835 });836 });837838 it('Case #18', () => {839 const itemObject = parseString('Strange Hot Heels', true, false);840841 assert.deepEqual(itemObject, {842 name: 'Hot Heels',843 craftable: true,844 quality: 11,845 });846 });847848 it('Case #19', () => {849 const itemObject = parseString(850 'Strange A Head Full of Hot Air',851 true,852 false853 );854855 assert.deepEqual(itemObject, {856 name: 'A Head Full of Hot Air',857 craftable: true,858 quality: 11,859 });860 });861862 it('Case #20', () => {863 const itemObject = parseString('Strange Vintage Tyrolean', true, false);864865 assert.deepEqual(itemObject, {866 name: 'Vintage Tyrolean',867 quality: 11,868 craftable: true,869 });870 });871872 it('Case #21', () => {873 const itemObject = parseString(874 'Strange Vintage Vintage Tyrolean',875 true,876 false877 );878879 assert.deepEqual(itemObject, {880 name: 'Vintage Tyrolean',881 quality: 3,882 elevated: true,883 craftable: true,884 });885 });886887 it('Case #22', () => {888 const itemObject = parseString('Vintage Tyrolean', true, false);889890 assert.deepEqual(itemObject, {891 name: 'Vintage Tyrolean',892 quality: 6,893 craftable: true,894 });895 });896897 it('Case #23', () => {898 const itemObject = parseString('Vintage Vintage Tyrolean', true, false);899900 assert.deepEqual(itemObject, {901 name: 'Vintage Tyrolean',902 quality: 3,903 craftable: true,904 });905 });906907 it('Case #24', () => {908 const itemObject = parseString('Strange Haunted Hat', true, false);909910 assert.deepEqual(itemObject, {911 name: 'Haunted Hat',912 quality: 11,913 craftable: true,914 });915 });916917 it('Case #25', () => {918 const itemObject = parseString(919 'Strange Haunted Haunted Hat',920 true,921 false922 );923924 assert.deepEqual(itemObject, {925 name: 'Haunted Hat',926 quality: 13,927 elevated: true,928 craftable: true,929 });930 });931932 it('Case #26', () => {933 const itemObject = parseString('Haunted Hat', true, false);934935 assert.deepEqual(itemObject, {936 name: 'Haunted Hat',937 quality: 6,938 craftable: true,939 });940 });941942 it('Case #27', () => {943 const itemObject = parseString('Haunted Haunted Hat', true, false);944945 assert.deepEqual(itemObject, {946 name: 'Haunted Hat',947 quality: 13,948 craftable: true,949 });950 });951952 it('Case #28', () => {953 const itemObject = parseString(954 'Eerie Orbiting Fire Condor Cap',955 true,956 false957 );958959 assert.deepEqual(itemObject, {960 name: 'Condor Cap',961 quality: 5,962 effect: 40,963 craftable: true,964 });965 });966967 it('Case #29', () => {968 const itemObject = parseString(969 'Haunted Ghosts War Paint (Battle Scarred)',970 true,971 false972 );973974 assert.deepEqual(itemObject, {975 name: 'War Paint',976 quality: 15,977 texture: 236,978 craftable: true,979 wear: 5,980 });981 });982983 it('Case #30', () => {984 const itemObject = parseString(985 'Spellbound Aspect Taunt: Most Wanted',986 true,987 false988 );989990 assert.deepEqual(itemObject, {991 name: 'Taunt: Most Wanted',992 quality: 5,993 effect: 3043,994 craftable: true,995 });996 });997998 it('Case #31', () => {999 const itemObject = parseString(1000 'Haunted Phantasm Jr Bonk Boy',1001 true,1002 false1003 );10041005 assert.deepEqual(itemObject, {1006 name: 'Bonk Boy',1007 quality: 5,1008 effect: 86,1009 craftable: true,1010 });1011 });10121013 it('Case #32', () => {1014 const itemObject = parseString(1015 'Ghastly Ghosts Jr Bonk Boy',1016 true,1017 false1018 );10191020 assert.deepEqual(itemObject, {1021 name: 'Bonk Boy',1022 quality: 5,1023 effect: 85,1024 craftable: true,1025 });1026 });10271028 it('Case #33', () => {1029 const itemObject = parseString(1030 'Haunted Ghosts Battle Boonie',1031 true,1032 false1033 );10341035 assert.deepEqual(itemObject, {1036 name: 'Battle Boonie',1037 quality: 5,1038 effect: 8,1039 craftable: true,1040 });1041 });10421043 it('Case #34', () => {1044 const itemObject = parseString('Smoking Jacket', true, false);10451046 assert.deepEqual(itemObject, {1047 name: 'Smoking Jacket',1048 craftable: true,1049 quality: 6,1050 });1051 });10521053 it('Case #35', () => {1054 const itemObject = parseString('Smoking Smoking Skid Lid', true, false);10551056 assert.deepEqual(itemObject, {1057 name: 'Smoking Skid Lid',1058 craftable: true,1059 quality: 5,1060 effect: 35,1061 });1062 });10631064 it('Case #36', () => {1065 const itemObject = parseString(1066 'Purple Energy Smoking Skid Lid',1067 true,1068 false1069 );10701071 assert.deepEqual(itemObject, {1072 name: 'Smoking Skid Lid',1073 craftable: true,1074 quality: 5,1075 effect: 10,1076 });1077 });10781079 it('Case #37', () => {1080 const itemObject = parseString('Smoking Skid Lid', true, false);10811082 assert.deepEqual(itemObject, {1083 name: 'Smoking Skid Lid',1084 craftable: true,1085 quality: 6,1086 });1087 });10881089 it('Case #38', () => {1090 const itemObject = parseString(1091 'Strange Cosmetic Part: Kills',1092 true,1093 false1094 );10951096 assert.deepEqual(itemObject, {1097 name: 'Strange Cosmetic Part: Kills',1098 craftable: true,1099 quality: 6,1100 });1101 });11021103 it('Case #39', () => {1104 const itemObject = parseString('The Value of Teamwork', true, false);11051106 assert.deepEqual(itemObject, {1107 name: 'The Value of Teamwork',1108 craftable: true,1109 quality: 6,1110 });1111 });11121113 it('Case #40', () => {1114 const itemObject = parseString(1115 'The Essential Accessories',1116 true,1117 false1118 );11191120 assert.deepEqual(itemObject, {1121 name: 'The Essential Accessories',1122 craftable: true,1123 quality: 6,1124 });1125 });11261127 it('Case #41', () => {1128 const itemObject = parseString('Genuine Atomic Accolade', true, false);11291130 assert.deepEqual(itemObject, {1131 name: 'Atomic Accolade',1132 craftable: true,1133 quality: 1,1134 });1135 });11361137 it('Case #42', () => {1138 const itemObject = parseString('Bonk! Atomic Punch', true, false);11391140 assert.deepEqual(itemObject, {1141 name: 'Bonk! Atomic Punch',1142 craftable: true,1143 quality: 6,1144 });1145 });11461147 it('Case #43 - Item with native `The` with craft number', () => {1148 const itemObject = parseString(1149 'The Concealed Killer Weapons Case #93',1150 true,1151 false1152 );11531154 assert.deepEqual(itemObject, {1155 name: 'The Concealed Killer Weapons Case',1156 craftable: true,1157 quality: 6,1158 itemNumber: { type: 'crate', value: 93 },1159 });1160 });11611162 it('Case #44 - Old retired keys', () => {1163 const itemObject = parseString(1164 'Non-Craftable Naughty Winter Crate Key 2014',1165 true,1166 false1167 );11681169 assert.deepEqual(itemObject, {1170 name: 'Naughty Winter Crate Key 2014',1171 craftable: false,1172 quality: 6,1173 });1174 });11751176 it('Case #45 - Munition case', () => {1177 const itemObject = parseString(1178 'Mann Co. Supply Munition #83',1179 true,1180 false1181 );11821183 assert.deepEqual(itemObject, {1184 name: 'Mann Co. Supply Munition',1185 craftable: true,1186 quality: 6,1187 itemNumber: { value: 83, type: 'crate' },1188 });1189 });11901191 it('Case #46 - Red Rock Roscoe Texture', () => {1192 class MockSchema extends Schema {1193 getTextureEnum() {1194 this.loadTextures();11951196 return 0;1197 }1198 }11991200 const format = createFormat(new MockSchema());12011202 const itemObject = format.parseString(1203 'Festivized Specialized Killstreak Red Rock Roscoe Pistol (Field-Tested)',1204 true,1205 false1206 );1207 assert.deepEqual(itemObject, {1208 name: 'Pistol',1209 quality: 15,1210 wear: 3,1211 festivized: true,1212 killstreak: 2,1213 texture: 0,1214 craftable: true,1215 });1216 });1217});12181219describe('parseString with defindexes and numbers.', () => {1220 it('Case #1', () => {1221 const itemObject = parseString(1222 'Cool Killstreak Aqua Marine Rocket Launcher (Battle Scarred)',1223 true,1224 true1225 );12261227 assert.deepEqual(itemObject, {1228 name: 'Rocket Launcher',1229 craftable: true,1230 killstreak: 1,1231 wear: 5,1232 texture: 57,1233 effect: 703,1234 quality: 5,1235 defindex: 205,1236 });1237 });12381239 it('Case #2', () => {1240 const itemObject = parseString(1241 "Strange High Roller's Rocket Launcher (Factory New)",1242 true,1243 true1244 );12451246 assert.deepEqual(itemObject, {1247 name: 'Rocket Launcher',1248 craftable: true,1249 wear: 1,1250 texture: 79,1251 quality: 11,1252 defindex: 205,1253 });1254 });1255 /*1256 it('Case #3', () => {1257 const itemObject = parseString(1258 "Collector's Battalion's Backup Chemistry Set",1259 true, true1260 );12611262 assert.deepEqual(itemObject, {1263 name: 'Chemistry Set',1264 craftable: true,1265 output: "Battalion's Backup",1266 outputQuality: 14,1267 quality: 6,1268 outputDefindex: 226,1269 defindex: 20000,1270 });1271 });1272 */1273 it('Case #4', () => {1274 const itemObject = parseString(1275 'Strange Festivized Professional Killstreak Australium Scattergun',1276 true,1277 true1278 );12791280 assert.deepEqual(itemObject, {1281 name: 'Scattergun',1282 craftable: true,1283 australium: true,1284 festivized: true,1285 killstreak: 3,1286 quality: 11,1287 defindex: 200,1288 });1289 });12901291 it('Case #5', () => {1292 const itemObject = parseString(1293 'Demonflame Modest Pile of Hat',1294 true,1295 true1296 );12971298 assert.deepEqual(itemObject, {1299 name: 'Modest Pile of Hat',1300 craftable: true,1301 effect: 80,1302 quality: 5,1303 defindex: 139,1304 });1305 });13061307 it('Case #6', () => {1308 const itemObject = parseString(1309 'Strange Omniscient Orb Balloonihoodie',1310 true,1311 true1312 );13131314 assert.deepEqual(itemObject, {1315 name: 'Balloonihoodie',1316 craftable: true,1317 effect: 120,1318 quality: 5,1319 elevated: true,1320 defindex: 30928,1321 });1322 });13231324 it('Case #7', () => {1325 const itemObject = parseString(1326 'Non-Craftable Specialized Killstreak Gunboats Kit Fabricator',1327 true,1328 true1329 );13301331 assert.deepEqual(itemObject, {1332 name: 'Specialized Killstreak Kit Fabricator',1333 defindex: 'HERE',1334 craftable: false,1335 killstreak: 2,1336 target: 'Gunboats',1337 quality: 6,1338 targetDefindex: 133,1339 defindex: 20002,1340 });1341 });13421343 it('Case #8', () => {1344 const itemObject = parseString(1345 'Archimedes Strangifier Chemistry Set',1346 true,1347 true1348 );13491350 assert.deepEqual(itemObject, {1351 name: 'Chemistry Set',1352 craftable: true,1353 target: 'Archimedes',1354 output: 'Strangifier',1355 outputQuality: 6,1356 quality: 6,1357 targetDefindex: 828,1358 outputDefindex: 5661,1359 defindex: 20005,1360 });1361 });13621363 it('Case #9', () => {1364 const itemObject = parseString('Strange Backwards Ballcap', true, true);13651366 assert.deepEqual(itemObject, {1367 name: 'Backwards Ballcap',1368 craftable: true,1369 quality: 11,1370 defindex: 617,1371 });1372 });13731374 it('Case #10', () => {1375 const itemObject = parseString(1376 'Professional Killstreak Iron Curtain Kit Fabricator',1377 true,1378 true1379 );13801381 assert.deepEqual(itemObject, {1382 name: 'Professional Killstreak Kit Fabricator',1383 craftable: true,1384 killstreak: 3,1385 target: 'Iron Curtain',1386 quality: 6,1387 targetDefindex: 298,1388 defindex: 20003,1389 });1390 });13911392 it('Case #11', () => {1393 const itemObject = parseString(1394 'Strange Professional Killstreak Festive Grenade Launcher',1395 true,1396 true1397 );13981399 assert.deepEqual(itemObject, {1400 name: 'Festive Grenade Launcher',1401 craftable: true,1402 killstreak: 3,1403 quality: 11,1404 defindex: 1007,1405 });1406 });14071408 it('Case #12', () => {1409 const itemObject = parseString(1410 'Strange Unique Sniper Rifle',1411 true,1412 true1413 );14141415 assert.deepEqual(itemObject, {1416 name: 'Sniper Rifle',1417 craftable: true,1418 quality: 6,1419 elevated: true,1420 defindex: 201,1421 });1422 });14231424 it('Case #13', () => {1425 const itemObject = parseString('Australium Gold', true, true);14261427 assert.deepEqual(itemObject, {1428 name: 'Australium Gold',1429 craftable: true,1430 quality: 6,1431 defindex: 5037,1432 });1433 });14341435 it('Case #14', () => {1436 const itemObject = parseString('Blue Moon Case #118', true, true);14371438 assert.deepEqual(itemObject, {1439 name: 'Blue Moon Case',1440 craftable: true,1441 itemNumber: { type: 'crate', value: 118 },1442 quality: 6,1443 });1444 });14451446 it('Case #15', () => {1447 const itemObject = parseString('The Tartan Shade', true, true);14481449 assert.deepEqual(itemObject, {1450 name: 'Tartan Shade',1451 craftable: true,1452 quality: 6,1453 isUniqueHat: true,1454 defindex: 30064,1455 });1456 });14571458 it('Case #16', () => {1459 const itemObject = parseString('Strange Cool Breeze', true, true);14601461 assert.deepEqual(itemObject, {1462 name: 'Cool Breeze',1463 craftable: true,1464 quality: 11,1465 defindex: 979,1466 });1467 });14681469 it('Case #17', () => {1470 const itemObject = parseString('Strange Hot Case', true, true);14711472 assert.deepEqual(itemObject, {1473 name: 'Hot Case',1474 craftable: true,1475 quality: 11,1476 defindex: 30986,1477 });1478 });14791480 it('Case #18', () => {1481 const itemObject = parseString('Strange Hot Heels', true, true);14821483 assert.deepEqual(itemObject, {1484 name: 'Hot Heels',1485 craftable: true,1486 quality: 11,1487 defindex: 30754,1488 });1489 });14901491 it('Case #19', () => {1492 const itemObject = parseString(1493 'Strange A Head Full of Hot Air',1494 true,1495 true1496 );14971498 assert.deepEqual(itemObject, {1499 name: 'A Head Full of Hot Air',1500 craftable: true,1501 quality: 11,1502 defindex: 30662,1503 });1504 });15051506 it('Case #20', () => {1507 const itemObject = parseString(1508 'Taunt: Kazotsky Kick Unusualifier',1509 true,1510 true1511 );15121513 assert.deepEqual(itemObject, {1514 name: 'Unusualifier',1515 craftable: true,1516 quality: 5,1517 defindex: 9258,1518 target: 'Taunt: Kazotsky Kick',1519 targetDefindex: 1157,1520 });1521 });15221523 it('Case #21', () => {1524 const itemObject = parseString('Ghostly Gibus Strangifier', true, true);15251526 assert.deepEqual(itemObject, {1527 name: 'Strangifier',1528 craftable: true,1529 quality: 6,1530 defindex: 5661,1531 target: 'Ghostly Gibus',1532 targetDefindex: 940,1533 });1534 });15351536 it('Case #22', () => {1537 const itemObject = parseString('Strange Bacon Grease', true, true);15381539 assert.deepEqual(itemObject, {1540 name: 'Strange Bacon Grease',1541 craftable: true,1542 quality: 6,1543 defindex: 5633,1544 });1545 });15461547 it('Case #23', () => {1548 const itemObject = parseString('Strange Vintage Tyrolean', true, true);15491550 assert.deepEqual(itemObject, {1551 name: 'Vintage Tyrolean',1552 quality: 11,1553 craftable: true,1554 defindex: 101,1555 });1556 });15571558 it('Case #24', () => {1559 const itemObject = parseString(1560 'Strange Vintage Vintage Tyrolean',1561 true,1562 true1563 );15641565 assert.deepEqual(itemObject, {1566 name: 'Vintage Tyrolean',1567 quality: 3,1568 elevated: true,1569 craftable: true,1570 defindex: 101,1571 });1572 });15731574 it('Case #25', () => {1575 const itemObject = parseString('Vintage Tyrolean', true, true);15761577 assert.deepEqual(itemObject, {1578 name: 'Vintage Tyrolean',1579 quality: 6,1580 craftable: true,1581 defindex: 101,1582 });1583 });15841585 it('Case #26', () => {1586 const itemObject = parseString('Vintage Vintage Tyrolean', true, true);15871588 assert.deepEqual(itemObject, {1589 name: 'Vintage Tyrolean',1590 quality: 3,1591 craftable: true,1592 defindex: 101,1593 });1594 });15951596 it('Case #27', () => {1597 const itemObject = parseString('Strange Haunted Hat', true, true);15981599 assert.deepEqual(itemObject, {1600 name: 'Haunted Hat',1601 quality: 11,1602 craftable: true,1603 defindex: 30300,1604 });1605 });16061607 it('Case #28', () => {1608 const itemObject = parseString(1609 'Strange Haunted Haunted Hat',1610 true,1611 true1612 );16131614 assert.deepEqual(itemObject, {1615 name: 'Haunted Hat',1616 quality: 13,1617 elevated: true,1618 craftable: true,1619 defindex: 30300,1620 });1621 });16221623 it('Case #29', () => {1624 const itemObject = parseString('Haunted Hat', true, true);16251626 assert.deepEqual(itemObject, {1627 name: 'Haunted Hat',1628 quality: 6,1629 craftable: true,1630 defindex: 30300,1631 });1632 });16331634 it('Case #30', () => {1635 const itemObject = parseString('Haunted Haunted Hat', true, true);16361637 assert.deepEqual(itemObject, {1638 name: 'Haunted Hat',1639 defindex: 30300,1640 quality: 13,1641 craftable: true,1642 });1643 });16441645 it('Case #31', () => {1646 const itemObject = parseString(1647 'Eerie Orbiting Fire Condor Cap',1648 true,1649 true1650 );16511652 assert.deepEqual(itemObject, {1653 name: 'Condor Cap',1654 quality: 5,1655 effect: 40,1656 craftable: true,1657 defindex: 30553,1658 });1659 });16601661 it('Case #32', () => {1662 const itemObject = parseString(1663 'Haunted Ghosts War Paint (Battle Scarred)',1664 true,1665 true1666 );16671668 assert.deepEqual(itemObject, {1669 name: 'War Paint',1670 quality: 15,1671 texture: 236,1672 craftable: true,1673 wear: 5,1674 defindex: 9536,1675 });1676 });16771678 it('Case #33', () => {1679 const itemObject = parseString(1680 'Spellbound Aspect Taunt: Most Wanted',1681 true,1682 true1683 );16841685 assert.deepEqual(itemObject, {1686 name: 'Taunt: Most Wanted',1687 quality: 5,1688 effect: 3043,1689 craftable: true,1690 defindex: 30614,1691 });1692 });16931694 it('Case #34', () => {1695 const itemObject = parseString(1696 'Haunted Phantasm Jr Bonk Boy',1697 true,1698 true1699 );17001701 assert.deepEqual(itemObject, {1702 name: 'Bonk Boy',1703 quality: 5,1704 effect: 86,1705 craftable: true,1706 defindex: 451,1707 });1708 });17091710 it('Case #35', () => {1711 const itemObject = parseString(1712 'Ghastly Ghosts Jr Bonk Boy',1713 true,1714 true1715 );17161717 assert.deepEqual(itemObject, {1718 name: 'Bonk Boy',1719 defindex: 451,1720 quality: 5,1721 effect: 85,1722 craftable: true,1723 });1724 });17251726 it('Case #36', () => {1727 const itemObject = parseString(1728 'Haunted Ghosts Battle Boonie',1729 true,1730 true1731 );17321733 assert.deepEqual(itemObject, {1734 name: 'Battle Boonie',1735 quality: 5,1736 effect: 8,1737 craftable: true,1738 defindex: 30907,1739 });1740 });17411742 it('Case #37', () => {1743 const itemObject = parseString('Smoking Jacket', true, true);17441745 assert.deepEqual(itemObject, {1746 name: 'Smoking Jacket',1747 craftable: true,1748 quality: 6,1749 defindex: 31124,1750 });1751 });17521753 it('Case #38', () => {1754 const itemObject = parseString('Smoking Smoking Skid Lid', true, true);17551756 assert.deepEqual(itemObject, {1757 name: 'Smoking Skid Lid',1758 craftable: true,1759 quality: 5,1760 effect: 35,1761 defindex: 30399,1762 });1763 });17641765 it('Case #39', () => {1766 const itemObject = parseString(1767 'Purple Energy Smoking Skid Lid',1768 true,1769 true1770 );17711772 assert.deepEqual(itemObject, {1773 name: 'Smoking Skid Lid',1774 craftable: true,1775 quality: 5,1776 effect: 10,1777 defindex: 30399,1778 });1779 });17801781 it('Case #40', () => {1782 const itemObject = parseString('Smoking Skid Lid', true, true);17831784 assert.deepEqual(itemObject, {1785 name: 'Smoking Skid Lid',1786 craftable: true,1787 quality: 6,1788 defindex: 30399,1789 });1790 });17911792 it('Case #41', () => {1793 const itemObject = parseString(1794 'Strange Cosmetic Part: Kills',1795 true,1796 true1797 );17981799 assert.deepEqual(itemObject, {1800 name: 'Strange Cosmetic Part: Kills',1801 craftable: true,1802 quality: 6,1803 defindex: 6060,1804 });1805 });18061807 it('Case #42', () => {1808 const itemObject = parseString('The Value of Teamwork', true, true);18091810 assert.deepEqual(itemObject, {1811 name: 'The Value of Teamwork',1812 craftable: true,1813 quality: 6,1814 defindex: 5064,1815 });1816 });18171818 it('Case #43', () => {1819 const itemObject = parseString('The Essential Accessories', true, true);18201821 assert.deepEqual(itemObject, {1822 name: 'The Essential Accessories',1823 craftable: true,1824 quality: 6,1825 defindex: 347,1826 });1827 });18281829 it('Case #44', () => {1830 const itemObject = parseString('Genuine Atomic Accolade', true, true);18311832 assert.deepEqual(itemObject, {1833 name: 'Atomic Accolade',1834 defindex: 767,1835 craftable: true,1836 quality: 1,1837 });1838 });18391840 it('Case #45', () => {1841 const itemObject = parseString('Bonk! Atomic Punch', true, true);18421843 assert.deepEqual(itemObject, {1844 name: 'Bonk! Atomic Punch',1845 defindex: 46,1846 craftable: true,1847 quality: 6,1848 });1849 });18501851 it('Case #46 - The Value of Teamwork', () => {1852 const itemObject = parseString('The Value of Teamwork', true, true);18531854 assert.deepEqual(itemObject, {1855 name: 'The Value of Teamwork',1856 quality: 6,1857 craftable: true,1858 defindex: 5064,1859 });1860 });18611862 it('Case #47 - The Bitter Taste of Defeat and Lime', () => {1863 const itemObject = parseString(1864 'The Bitter Taste of Defeat and Lime',1865 true,1866 true1867 );18681869 assert.deepEqual(itemObject, {1870 name: 'The Bitter Taste of Defeat and Lime',1871 quality: 6,1872 craftable: true,1873 defindex: 5054,1874 });1875 });18761877 it('Case #48 - Item with native `The` with craft number', () => {1878 const itemObject = parseString(1879 'The Concealed Killer Weapons Case #93',1880 true,1881 true1882 );18831884 assert.deepEqual(itemObject, {1885 name: 'The Concealed Killer Weapons Case',1886 craftable: true,1887 quality: 6,1888 defindex: 5806,1889 itemNumber: { type: 'crate', value: 93 },1890 });1891 });18921893 it('Case #49 - Old retired keys', () => {1894 const itemObject = parseString(1895 'Non-Craftable Naughty Winter Crate Key 2014',1896 true,1897 true1898 );18991900 assert.deepEqual(itemObject, {1901 name: 'Naughty Winter Crate Key 2014',1902 craftable: false,1903 quality: 6,1904 defindex: 5791,1905 });1906 });19071908 it('Case #50 - Munition case', () => {1909 const itemObject = parseString(1910 'Mann Co. Supply Munition #83',1911 true,1912 true1913 );19141915 assert.deepEqual(itemObject, {1916 name: 'Mann Co. Supply Munition',1917 defindex: 5734,1918 craftable: true,1919 quality: 6,1920 itemNumber: { value: 83, type: 'crate' },1921 });1922 });19231924 it('Case #51 - Bat', () => {1925 class MockSchema extends Schema {1926 getDefindex() {1927 return 0;1928 }1929 }19301931 const format = createFormat(new MockSchema());19321933 const itemObject = format.parseString('Bat', true, true);1934 assert.deepEqual(itemObject, {1935 name: 'Bat',1936 quality: 6,1937 defindex: 0,1938 craftable: true,1939 });1940 });19411942 it('Case #52 - Bat output', () => {1943 class MockSchema extends Schema {1944 getDefindex(input) {1945 if (input === 'Bat') {1946 return 0;1947 }19481949 return super.getDefindex(input);1950 }1951 }19521953 const format = createFormat(new MockSchema());19541955 const itemObject = format.parseString(1956 "Collector's Bat Chemistry Set",1957 true,1958 true1959 );1960 assert.deepEqual(itemObject, {1961 name: 'Chemistry Set',1962 quality: 6,1963 defindex: 20005,1964 craftable: true,1965 output: 'Bat',1966 outputDefindex: 0,1967 outputQuality: 14,1968 });1969 });19701971 it('Case #52 - Bat target', () => {1972 class MockSchema extends Schema {1973 getDefindex(input) {1974 if (input === 'Bat') {1975 return 0;1976 }19771978 return super.getDefindex(input);1979 }1980 }19811982 const format = createFormat(new MockSchema());19831984 const itemObject = format.parseString(1985 'Non-Craftable Specialized Killstreak Bat Kit Fabricator',1986 true,1987 true1988 );1989 assert.deepEqual(itemObject, {1990 name: 'Specialized Killstreak Kit Fabricator',1991 quality: 6,1992 defindex: 20002,1993 craftable: false,1994 killstreak: 2,1995 target: 'Bat',1996 targetDefindex: 0,1997 });1998 });19992000 it('Case #53 - Accursed Apparition', () => {2001 const itemObject = parseString('Accursed Apparition', true, true);2002 assert.deepEqual(itemObject, {2003 name: 'Accursed Apparition',2004 quality: 6,2005 craftable: true,2006 defindex: 30206,2007 });2008 });20092010 it('Case #54 - Unusual Haunted Metal Scrap', () => {2011 const itemObject = parseString('Unusual Haunted Metal Scrap', true, true);2012 assert.deepEqual(itemObject, {2013 name: 'Haunted Metal Scrap',2014 quality: 5,2015 craftable: true,2016 defindex: 267,2017 });2018 });20192020 it('Case #55 - Strange Normal Medi Gun', () => {2021 const itemObject = parseString('Strange Normal Medi Gun', true, true);2022 assert.deepEqual(itemObject, {2023 name: 'Medi Gun',2024 quality: 0,2025 craftable: true,2026 defindex: 211,2027 elevated: true,2028 });2029 }); ...

Full Screen

Full Screen

colorStrings.spec.js

Source:colorStrings.spec.js Github

copy

Full Screen

1import ColorStrings from '../src/colorStrings'2function parseString(string, match, parse) {3 const matched = match.exec(string)4 if (matched !== null) {5 return parse(matched)6 }7 return false8}9describe('ColorStrings', () => {10 describe('RGB', () => {11 test('should parse rgb', () => {12 expect(13 parseString(14 'rgb(100, 150, 200)',15 ColorStrings.RGB.match,16 ColorStrings.RGB.parse17 )18 ).toEqual({19 r: 100,20 g: 150,21 b: 200,22 a: 123 })24 expect(25 parseString(26 'rgba(100, 150, 200, 1)',27 ColorStrings.RGB.match,28 ColorStrings.RGB.parse29 )30 ).toEqual(false)31 expect(32 parseString(33 'hsl(0, 100%, 50%)',34 ColorStrings.RGB.match,35 ColorStrings.RGB.parse36 )37 ).toEqual(false)38 expect(39 parseString(40 'hsla(0, 100%, 50%, 1)',41 ColorStrings.RGB.match,42 ColorStrings.RGB.parse43 )44 ).toEqual(false)45 expect(46 parseString(47 'transparent',48 ColorStrings.RGB.match,49 ColorStrings.RGB.parse50 )51 ).toEqual(false)52 expect(53 parseString('#ffffff', ColorStrings.RGB.match, ColorStrings.RGB.parse)54 ).toEqual(false)55 expect(56 parseString('white', ColorStrings.RGB.match, ColorStrings.RGB.parse)57 ).toEqual(false)58 })59 test('should convent to rgb', () => {60 expect(61 ColorStrings.RGB.to({62 r: 100,63 g: 150,64 b: 200,65 a: 166 })67 ).toEqual('rgb(100, 150, 200)')68 })69 })70 describe('RGBA', () => {71 test('should parse rgba', () => {72 expect(73 parseString(74 'rgba(100, 150, 200, 0.1)',75 ColorStrings.RGBA.match,76 ColorStrings.RGBA.parse77 )78 ).toEqual({79 r: 100,80 g: 150,81 b: 200,82 a: 0.183 })84 expect(85 parseString(86 'rgba(100, 150, 200, 10%)',87 ColorStrings.RGBA.match,88 ColorStrings.RGBA.parse89 )90 ).toEqual({91 r: 100,92 g: 150,93 b: 200,94 a: 0.195 })96 expect(97 parseString(98 'rgb(100, 150, 200)',99 ColorStrings.RGBA.match,100 ColorStrings.RGBA.parse101 )102 ).toEqual(false)103 expect(104 parseString(105 'hsl(0, 100%, 50%)',106 ColorStrings.RGBA.match,107 ColorStrings.RGBA.parse108 )109 ).toEqual(false)110 expect(111 parseString(112 'hsla(0, 100%, 50%, 1)',113 ColorStrings.RGBA.match,114 ColorStrings.RGBA.parse115 )116 ).toEqual(false)117 expect(118 parseString(119 'transparent',120 ColorStrings.RGBA.match,121 ColorStrings.RGBA.parse122 )123 ).toEqual(false)124 expect(125 parseString('#ffffff', ColorStrings.RGBA.match, ColorStrings.RGBA.parse)126 ).toEqual(false)127 expect(128 parseString('white', ColorStrings.RGBA.match, ColorStrings.RGBA.parse)129 ).toEqual(false)130 })131 test('should convent to rgba', () => {132 expect(133 ColorStrings.RGBA.to({134 r: 100,135 g: 150,136 b: 200,137 a: 0.5138 })139 ).toEqual('rgba(100, 150, 200, 0.5)')140 })141 })142 describe('HSL', () => {143 test('should parse hsl', () => {144 expect(145 parseString(146 'hsl(0, 100%, 50%)',147 ColorStrings.HSL.match,148 ColorStrings.HSL.parse149 )150 ).toEqual({151 r: 255,152 g: 0,153 b: 0,154 a: 1155 })156 expect(157 parseString(158 'hsl(480, 1, 0.5)',159 ColorStrings.HSL.match,160 ColorStrings.HSL.parse161 )162 ).toEqual({163 r: 0,164 g: 255,165 b: 0,166 a: 1167 })168 expect(169 parseString(170 'rgb(100, 150, 200)',171 ColorStrings.HSL.match,172 ColorStrings.HSL.parse173 )174 ).toEqual(false)175 expect(176 parseString(177 'rgba(100, 150, 200, 0.1)',178 ColorStrings.HSL.match,179 ColorStrings.HSL.parse180 )181 ).toEqual(false)182 expect(183 parseString(184 'hsla(0, 100%, 50%, 1)',185 ColorStrings.HSL.match,186 ColorStrings.HSL.parse187 )188 ).toEqual(false)189 expect(190 parseString(191 'transparent',192 ColorStrings.HSL.match,193 ColorStrings.HSL.parse194 )195 ).toEqual(false)196 expect(197 parseString('#ffffff', ColorStrings.HSL.match, ColorStrings.HSL.parse)198 ).toEqual(false)199 expect(200 parseString('white', ColorStrings.HSL.match, ColorStrings.HSL.parse)201 ).toEqual(false)202 })203 test('should convent to hsl', () => {204 expect(205 ColorStrings.HSL.to({206 r: 255,207 g: 0,208 b: 0,209 a: 0.5210 })211 ).toEqual('hsl(0, 100%, 50%)')212 })213 })214 describe('HSLA', () => {215 test('should parse hsl', () => {216 expect(217 parseString(218 'hsla(0, 100%, 50%, 50%)',219 ColorStrings.HSLA.match,220 ColorStrings.HSLA.parse221 )222 ).toEqual({223 r: 255,224 g: 0,225 b: 0,226 a: 0.5227 })228 expect(229 parseString(230 'hsla(480, 1, 0.5, 0.5)',231 ColorStrings.HSLA.match,232 ColorStrings.HSLA.parse233 )234 ).toEqual({235 r: 0,236 g: 255,237 b: 0,238 a: 0.5239 })240 expect(241 parseString(242 'rgb(100, 150, 200)',243 ColorStrings.HSLA.match,244 ColorStrings.HSLA.parse245 )246 ).toEqual(false)247 expect(248 parseString(249 'rgba(100, 150, 200, 0.1)',250 ColorStrings.HSLA.match,251 ColorStrings.HSLA.parse252 )253 ).toEqual(false)254 expect(255 parseString(256 'hsl(0, 100%, 50%)',257 ColorStrings.HSLA.match,258 ColorStrings.HSLA.parse259 )260 ).toEqual(false)261 expect(262 parseString(263 'transparent',264 ColorStrings.HSLA.match,265 ColorStrings.HSLA.parse266 )267 ).toEqual(false)268 expect(269 parseString('#ffffff', ColorStrings.HSLA.match, ColorStrings.HSLA.parse)270 ).toEqual(false)271 expect(272 parseString('white', ColorStrings.HSLA.match, ColorStrings.HSLA.parse)273 ).toEqual(false)274 })275 test('should convent to hsla', () => {276 expect(277 ColorStrings.HSLA.to({278 r: 255,279 g: 0,280 b: 0,281 a: 0.5282 })283 ).toEqual('hsla(0, 100%, 50%, 0.5)')284 })285 })286 describe('HEX', () => {287 test('should parse hex', () => {288 expect(289 parseString('#ff0000', ColorStrings.HEX.match, ColorStrings.HEX.parse)290 ).toEqual({291 r: 255,292 g: 0,293 b: 0,294 a: 1295 })296 expect(297 parseString('#fff', ColorStrings.HEX.match, ColorStrings.HEX.parse)298 ).toEqual({299 r: 255,300 g: 255,301 b: 255,302 a: 1303 })304 expect(305 parseString(306 'rgb(100, 150, 200)',307 ColorStrings.HEX.match,308 ColorStrings.HEX.parse309 )310 ).toEqual(false)311 expect(312 parseString(313 'rgba(100, 150, 200, 0.1)',314 ColorStrings.HEX.match,315 ColorStrings.HEX.parse316 )317 ).toEqual(false)318 expect(319 parseString(320 'hsl(0, 100%, 50%)',321 ColorStrings.HEX.match,322 ColorStrings.HEX.parse323 )324 ).toEqual(false)325 expect(326 parseString(327 'hsla(0, 100%, 50%, 0.1)',328 ColorStrings.HEX.match,329 ColorStrings.HEX.parse330 )331 ).toEqual(false)332 expect(333 parseString(334 'transparent',335 ColorStrings.HEX.match,336 ColorStrings.HEX.parse337 )338 ).toEqual(false)339 expect(340 parseString('white', ColorStrings.HEX.match, ColorStrings.HEX.parse)341 ).toEqual(false)342 })343 test('should convent to hex', () => {344 expect(345 ColorStrings.HEX.to({346 r: 255,347 g: 0,348 b: 0,349 a: 1350 })351 ).toEqual('#ff0000')352 })353 })354 describe('TRANSPARENT', () => {355 test('should parse transparent', () => {356 expect(357 parseString(358 'transparent',359 ColorStrings.TRANSPARENT.match,360 ColorStrings.TRANSPARENT.parse361 )362 ).toEqual({363 r: 0,364 g: 0,365 b: 0,366 a: 0367 })368 expect(369 parseString(370 'TRANSPARENT',371 ColorStrings.TRANSPARENT.match,372 ColorStrings.TRANSPARENT.parse373 )374 ).toEqual({375 r: 0,376 g: 0,377 b: 0,378 a: 0379 })380 expect(381 parseString(382 'rgb(100, 150, 200)',383 ColorStrings.TRANSPARENT.match,384 ColorStrings.TRANSPARENT.parse385 )386 ).toEqual(false)387 expect(388 parseString(389 'rgba(100, 150, 200, 0.1)',390 ColorStrings.TRANSPARENT.match,391 ColorStrings.TRANSPARENT.parse392 )393 ).toEqual(false)394 expect(395 parseString(396 'hsl(0, 100%, 50%)',397 ColorStrings.TRANSPARENT.match,398 ColorStrings.TRANSPARENT.parse399 )400 ).toEqual(false)401 expect(402 parseString(403 'hsla(0, 100%, 50%, 0.1)',404 ColorStrings.TRANSPARENT.match,405 ColorStrings.TRANSPARENT.parse406 )407 ).toEqual(false)408 expect(409 parseString(410 '#ff0000',411 ColorStrings.TRANSPARENT.match,412 ColorStrings.TRANSPARENT.parse413 )414 ).toEqual(false)415 expect(416 parseString(417 'white',418 ColorStrings.TRANSPARENT.match,419 ColorStrings.TRANSPARENT.parse420 )421 ).toEqual(false)422 })423 test('should convent to transparent', () => {424 expect(425 ColorStrings.TRANSPARENT.to({426 r: 0,427 g: 0,428 b: 0,429 a: 0430 })431 ).toEqual('transparent')432 })433 })434 describe('NAME', () => {435 test('should parse color name', () => {436 expect(437 parseString('white', ColorStrings.NAME.match, ColorStrings.NAME.parse)438 ).toEqual({439 r: 255,440 g: 255,441 b: 255,442 a: 1443 })444 expect(445 parseString('yellow', ColorStrings.NAME.match, ColorStrings.NAME.parse)446 ).toEqual({447 r: 255,448 g: 255,449 b: 0,450 a: 1451 })452 expect(453 parseString(454 'rgb(100, 150, 200)',455 ColorStrings.NAME.match,456 ColorStrings.NAME.parse457 )458 ).toEqual(false)459 expect(460 parseString(461 'rgba(100, 150, 200, 0.1)',462 ColorStrings.NAME.match,463 ColorStrings.NAME.parse464 )465 ).toEqual(false)466 expect(467 parseString(468 'hsl(0, 100%, 50%)',469 ColorStrings.NAME.match,470 ColorStrings.NAME.parse471 )472 ).toEqual(false)473 expect(474 parseString(475 'hsla(0, 100%, 50%, 0.1)',476 ColorStrings.NAME.match,477 ColorStrings.NAME.parse478 )479 ).toEqual(false)480 expect(481 parseString('#ff0000', ColorStrings.NAME.match, ColorStrings.NAME.parse)482 ).toEqual(false)483 })484 test('should convent to name', () => {485 expect(486 ColorStrings.NAME.to({487 r: 255,488 g: 255,489 b: 255,490 a: 1491 })492 ).toEqual('white')493 })494 })495})

Full Screen

Full Screen

localDateTest.js

Source:localDateTest.js Github

copy

Full Screen

...3const expect = chai.expect;4describe('LocalDate', () => {5 describe('#constructor()', () => {6 it('should parse string', () => {7 const localDate = LocalDate.parseString('2021-06-12');8 assert.equal(localDate.year, 2021);9 assert.equal(localDate.month, 6);10 assert.equal(localDate.day, 12);11 });12 it('should parse object', () => {13 const localDate = LocalDate.parseProperties({14 year: 2020,15 month: 5,16 day: 2517 });18 assert.equal(localDate.year, 2020);19 assert.equal(localDate.month, 5);20 assert.equal(localDate.day, 25);21 });22 it('should parse null', () => {23 const localDate = LocalDate.parseProperties(null);24 assert.equal(localDate.year, 0);25 assert.equal(localDate.month, 0);26 assert.equal(localDate.day, 0);27 });28 it('should parse blank string', () => {29 const localDate = LocalDate.parseString(' \t \n ');30 assert.equal(localDate.year, 0);31 assert.equal(localDate.month, 0);32 assert.equal(localDate.day, 0);33 });34 it('should fail on invalid string', () => {35 expect(() => {36 LocalDate.parseString('202-01-A')37 }).to.throw("The value '202-01-A' is not a valid LocalDate. The correct syntax is 'YYYY-MM-DD'.");38 });39 });40 describe('#isBefore()', () => {41 it('should work with non-null dates', () => {42 assert.equal(LocalDate.parseString('2021-02-01').isBefore(LocalDate.parseString('2021-05-01')), true);43 assert.equal(LocalDate.parseString('2020-12-01').isBefore(LocalDate.parseString('2021-05-01')), true);44 assert.equal(LocalDate.parseString('2020-12-01').isBefore(LocalDate.parseString('2020-12-06')), true);45 assert.equal(LocalDate.parseString('2020-12-01').isBefore(LocalDate.parseString('2020-10-01')), false);46 assert.equal(LocalDate.parseString('2021-10-01').isBefore(LocalDate.parseString('2020-10-01')), false);47 assert.equal(LocalDate.parseString('2021-10-25').isBefore(LocalDate.parseString('2021-10-01')), false);48 });49 });50 describe('#isAfter()', () => {51 it('should work with non-null dates', () => {52 assert.equal(LocalDate.parseString('2021-02-01').isAfter(LocalDate.parseString('2021-05-01')), false);53 assert.equal(LocalDate.parseString('2020-12-01').isAfter(LocalDate.parseString('2021-05-01')), false);54 assert.equal(LocalDate.parseString('2020-12-01').isAfter(LocalDate.parseString('2020-12-06')), false);55 assert.equal(LocalDate.parseString('2020-12-01').isAfter(LocalDate.parseString('2020-10-01')), true);56 assert.equal(LocalDate.parseString('2021-10-01').isAfter(LocalDate.parseString('2020-10-01')), true);57 assert.equal(LocalDate.parseString('2021-10-25').isAfter(LocalDate.parseString('2021-10-01')), true);58 });59 });60 describe('#equals()', () => {61 it('should work with non-null dates', () => {62 assert.equal(LocalDate.parseString('2021-02-01').equals(LocalDate.parseString('2021-02-01')), true);63 assert.equal(LocalDate.parseString('2021-02-01').equals(LocalDate.parseString('2021-02-25')), false);64 assert.equal(LocalDate.parseString('2021-02-01').equals(LocalDate.parseString('2021-07-01')), false);65 assert.equal(LocalDate.parseString('2021-02-01').equals(LocalDate.parseString('2019-02-01')), false);66 });67 });68 describe('#toString()', () => {69 it('should work with non-null dates', () => {70 assert.equal(LocalDate.parseString('2021-02-01').toString(), '2021-02-01');71 assert.equal(LocalDate.parseString('2021-09-15').toString(), '2021-09-15');72 assert.equal(LocalDate.parseString('2020-10-30').toString(), '2020-10-30');73 assert.equal(LocalDate.parseString('2020-12-31').toString(), '2020-12-31');74 });75 });76 describe('#nbDaysUntil()', () => {77 it('should work with non-null dates', () => {78 assert.equal(79 LocalDate.parseString('2021-02-01').nbDaysUntil(LocalDate.parseString('2021-02-01')),80 0);81 assert.equal(82 LocalDate.parseString('2021-02-01').nbDaysUntil(LocalDate.parseString('2021-02-02')),83 1);84 assert.equal(85 LocalDate.parseString('2021-02-02').nbDaysUntil(LocalDate.parseString('2021-02-01')),86 -1);87 assert.equal(88 LocalDate.parseString('2021-02-01').nbDaysUntil(LocalDate.parseString('2021-02-21')),89 20);90 assert.equal(91 LocalDate.parseString('2021-02-01').nbDaysUntil(LocalDate.parseString('2021-03-01')),92 28);93 assert.equal(94 LocalDate.parseString('2021-01-01').nbDaysUntil(LocalDate.parseString('2021-03-20')),95 31 + 28 + 19);96 assert.equal(97 LocalDate.parseString('2020-01-01').nbDaysUntil(LocalDate.parseString('2021-01-01')),98 366);99 assert.equal(100 LocalDate.parseString('2019-01-01').nbDaysUntil(LocalDate.parseString('2021-02-10')),101 365 * 2 + 31 + 10);102 });103 });104 describe('#nbYearsUntil()', () => {105 it('should work with non-null dates', () => {106 assert.equal(107 LocalDate.parseString('2021-02-01').nbYearsUntil(LocalDate.parseString('2021-02-01')),108 0);109 assert.equal(110 LocalDate.parseString('2021-02-01').nbYearsUntil(LocalDate.parseString('2022-02-01')),111 1);112 assert.equal(113 LocalDate.parseString('2020-01-01').nbYearsUntil(LocalDate.parseString('2019-01-01')),114 -1);115 assert.equal(116 LocalDate.parseString('2021-02-01').nbYearsUntil(LocalDate.parseString('2023-02-01')),117 2);118 });119 });120 describe('#findClosestAvailableLocalDate()', () => {121 it('should work with non-null dates', () => {122 const availableLocalDates = [123 LocalDate.parseString('2021-01-31'),124 LocalDate.parseString('2021-02-28'),125 LocalDate.parseString('2021-03-31'),126 LocalDate.parseString('2021-04-30'),127 LocalDate.parseString('2021-05-15'),128 LocalDate.parseString('2021-05-16'),129 LocalDate.parseString('2021-05-18'),130 ];131 assert.equal(132 LocalDate.findClosestAvailableLocalDate(133 availableLocalDates, LocalDate.parseString('2021-02-28')).toString(),134 '2021-02-28');135 assert.equal(136 LocalDate.findClosestAvailableLocalDate(137 availableLocalDates, LocalDate.parseString('2021-02-20')).toString(),138 '2021-02-28');139 assert.equal(140 LocalDate.findClosestAvailableLocalDate(141 availableLocalDates, LocalDate.parseString('2021-03-01')).toString(),142 '2021-02-28');143 assert.equal(144 LocalDate.findClosestAvailableLocalDate(145 availableLocalDates, LocalDate.parseString('1999-01-01')).toString(),146 '2021-01-31');147 assert.equal(148 LocalDate.findClosestAvailableLocalDate(149 availableLocalDates, LocalDate.parseString('2021-06-13')).toString(),150 '2021-05-18');151 assert.equal(152 LocalDate.findClosestAvailableLocalDate(153 availableLocalDates, LocalDate.parseString('2021-05-17')).toString(),154 '2021-05-16');155 assert.equal(156 LocalDate.findClosestAvailableLocalDate(157 availableLocalDates, LocalDate.parseString('2021-05-05')).toString(),158 '2021-04-30');159 assert.equal(160 LocalDate.findClosestAvailableLocalDate(161 availableLocalDates, LocalDate.parseString('2021-05-15')).toString(),162 '2021-05-15');163 });164 });165 describe('#toClosestYearMonth()', () => {166 it('should work with non-null dates', () => {167 assert.equal(LocalDate.parseString('2021-02-01').toClosestYearMonth().toString(), '2021-02');168 assert.equal(LocalDate.parseString('2021-02-10').toClosestYearMonth().toString(), '2021-02');169 assert.equal(LocalDate.parseString('2021-02-14').toClosestYearMonth().toString(), '2021-02');170 assert.equal(LocalDate.parseString('2021-02-15').toClosestYearMonth().toString(), '2021-03');171 assert.equal(LocalDate.parseString('2021-02-16').toClosestYearMonth().toString(), '2021-03');172 assert.equal(LocalDate.parseString('2021-02-28').toClosestYearMonth().toString(), '2021-03');173 assert.equal(LocalDate.parseString('2021-12-05').toClosestYearMonth().toString(), '2021-12');174 assert.equal(LocalDate.parseString('2021-12-30').toClosestYearMonth().toString(), '2022-01');175 });176 });177 describe('#compareAsc()', () => {178 it('should work with multiple dates', () => {179 const dates = [180 LocalDate.parseString('2021-05-14'),181 LocalDate.parseString('2021-05-12'),182 LocalDate.parseString('2021-04-28'),183 LocalDate.parseString('2021-06-28'),184 LocalDate.parseString('2020-10-01'),185 ];186 const sortedDates = dates.sort(LocalDate.compareAsc);187 assert.equal(sortedDates.length, 5);188 assert.equal(sortedDates[0].toString(), '2020-10-01');189 assert.equal(sortedDates[1].toString(), '2021-04-28');190 assert.equal(sortedDates[2].toString(), '2021-05-12');191 assert.equal(sortedDates[3].toString(), '2021-05-14');192 assert.equal(sortedDates[4].toString(), '2021-06-28');193 });194 });...

Full Screen

Full Screen

TestCombinatorParser.js

Source:TestCombinatorParser.js Github

copy

Full Screen

...96TestCombinatorParser.prototype.tearDown = function() {97}98// Test cases99TestCombinatorParser.prototype.testWord1 = function() {100 assertEquals("testWord1", word.parseString("a1234"), ["a1234"]);101}102TestCombinatorParser.prototype.testWord2 = function() {103 assertEquals("testWord2", word.parseString("a1234*"), null);104}105TestCombinatorParser.prototype.testText1 = function() {106 assertEquals("testText1", dot.parseString("."), ["."]);107}108TestCombinatorParser.prototype.testText2 = function() {109 assertEquals("testText2", dot.parseString(".*"), null);110}111TestCombinatorParser.prototype.testText3 = function() {112 assertEquals("testText3", text.parseString("text."), ["text", "."]);113}114TestCombinatorParser.prototype.testText4 = function() {115 assertEquals("testText4", dotf.parseString("."), ["."]);116}117TestCombinatorParser.prototype.testText5 = function() {118 assertEquals("testText5", dot2.parseString(".."), [".","."]);119}120TestCombinatorParser.prototype.testInteger1 = function() {121 assertEquals("testInteger1", num.parseString("1234"), [1234]);122}123TestCombinatorParser.prototype.testInteger2 = function() {124 assertEquals("testInteger2", num.parseString("1234*"), null);125}126TestCombinatorParser.prototype.testInteger3 = function() {127 assertEquals("testInteger3", nump.parseString("(333)"), ["(",333,")"]);128}129TestCombinatorParser.prototype.testInteger4 = function() {130 assertEquals("testInteger4", numq.parseString("(444)"), [444]);131}132TestCombinatorParser.prototype.testInteger5 = function() {133 assertEquals("testInteger5", numo.parseString("(555)"), ["(",555,")"]);134}135TestCombinatorParser.prototype.testInteger6 = function() {136 assertEquals("testInteger6", numo.parseString(""), [null]);137}138TestCombinatorParser.prototype.testInteger7 = function() {139 assertEquals("testInteger7", numo.parseString("x"), null);140}141TestCombinatorParser.prototype.testConst1 = function() {142 assertEquals("testConst1", con1.parseString(""), [11]);143}144TestCombinatorParser.prototype.testConst2 = function() {145 assertEquals("testConst2", con2.parseString(""), [22]);146}147TestCombinatorParser.prototype.testConst3 = function() {148 assertEquals("testConst3", con3.parseString(""), []);149}150TestCombinatorParser.prototype.testConst4 = function() {151 assertEquals("testConst4", con1.parseString("x"), null);152}153TestCombinatorParser.prototype.testVal1 = function() {154 assertEquals("testVal1", val.parseString("1"), [1]);155}156TestCombinatorParser.prototype.testVal2 = function() {157 assertEquals("testVal2", val.parseString("abc"), ["abc"]);158}159TestCombinatorParser.prototype.testPrim1 = function() {160 assertEquals("testPrim1", prim.parseString("1"), [1]);161}162TestCombinatorParser.prototype.testPrim2 = function() {163 assertEquals("testPrim2", prim.parseString("(22)"), ["(",22,")"]);164}165TestCombinatorParser.prototype.testFact1 = function() {166 assertEquals("testFact1", fact.parseString("1"), [1]);167}168TestCombinatorParser.prototype.testFact2 = function() {169 assertEquals("testFact2", fact.parseString("(22)"), [["(",22,")"]]);170}171TestCombinatorParser.prototype.testExpr1 = function() {172 assertEquals("testExpr1", expr.parseString("1+2*3."), [1,"+",2,"*",3,"."]);173}174TestCombinatorParser.prototype.testExpr2 = function() {175 assertEquals("testExpr2", expr.parseString("(1+2)*3."), [["(",1,"+",2,")"],"*",3,"."]);176}177TestCombinatorParser.prototype.testExpr3 = function() {178 assertEquals("testExpr3", expr.parseString("(1+2)*3"), null);179}180TestCombinatorParser.prototype.testExpr4 = function() {181 assertEquals("testExpr4", expr.parseString("(1+2)!3."), null);182}183TestCombinatorParser.prototype.testGen_delims1 = function() {184 assertEquals("testGen_delims1", gen_delims.parseString(":"), [":"]);185}186TestCombinatorParser.prototype.testGen_delims2 = function() {187 assertEquals("testGen_delims2", gen_delims.parseString("/"), ["/"]);188}189TestCombinatorParser.prototype.testGen_delims3 = function() {190 assertEquals("testGen_delims3", gen_delims.parseString("?"), ["?"]);191}192TestCombinatorParser.prototype.testGen_delims4 = function() {193 assertEquals("testGen_delims4", gen_delims.parseString("#"), ["#"]);194}195TestCombinatorParser.prototype.testGen_delims5 = function() {196 assertEquals("testGen_delims5", gen_delims.parseString("["), ["["]);197}198TestCombinatorParser.prototype.testGen_delims6 = function() {199 assertEquals("testGen_delims6", gen_delims.parseString("]"), ["]"]);200}201TestCombinatorParser.prototype.testGen_delims7 = function() {202 assertEquals("testGen_delims7", gen_delims.parseString("@"), ["@"]);203}204TestCombinatorParser.prototype.testSub_delims1 = function() {205 assertEquals("testSub_delims1", sub_delims.parseString("!"), ["!"]);206}207TestCombinatorParser.prototype.testSub_delims2 = function() {208 assertEquals("testSub_delims2", sub_delims.parseString("$"), ["$"]);209}210TestCombinatorParser.prototype.testSub_delims3 = function() {211 assertEquals("testSub_delims3", sub_delims.parseString("&"), ["&"]);212}213TestCombinatorParser.prototype.testSub_delims4 = function() {214 assertEquals("testSub_delims4", sub_delims.parseString("'"), ["'"]);215}216TestCombinatorParser.prototype.testSub_delims5 = function() {217 assertEquals("testSub_delims5", sub_delims.parseString("("), ["("]);218}219TestCombinatorParser.prototype.testSub_delims6 = function() {220 assertEquals("testSub_delims6", sub_delims.parseString(")"), [")"]);221}222TestCombinatorParser.prototype.testSub_delims7 = function() {223 assertEquals("testSub_delims7", sub_delims.parseString("*"), ["*"]);224}225TestCombinatorParser.prototype.testSub_delims8 = function() {226 assertEquals("testSub_delims8", sub_delims.parseString("+"), ["+"]);227}228TestCombinatorParser.prototype.testSub_delims9 = function() {229 assertEquals("testSub_delims9", sub_delims.parseString(","), [","]);230}231TestCombinatorParser.prototype.testSub_delims10 = function() {232 assertEquals("testSub_delims10", sub_delims.parseString(";"), [";"]);233}234TestCombinatorParser.prototype.testSub_delims11 = function() {235 assertEquals("testSub_delims11", sub_delims.parseString("="), ["="]);236}237TestCombinatorParser.prototype.testUnreserved1 = function() {238 assertEquals("testUnreserved1", unreserved.parseString("a"), ["a"]);239}240TestCombinatorParser.prototype.testUnreserved2 = function() {241 assertEquals("testUnreserved2", unreserved.parseString("Z"), ["Z"]);242}243TestCombinatorParser.prototype.testUnreserved3 = function() {244 assertEquals("testUnreserved3", unreserved.parseString("3"), ["3"]);245}246TestCombinatorParser.prototype.testUnreserved4 = function() {247 assertEquals("testUnreserved4", unreserved.parseString("-"), ["-"]);248}249TestCombinatorParser.prototype.testUnreserved5 = function() {250 assertEquals("testUnreserved5", unreserved.parseString("."), ["."]);251}252TestCombinatorParser.prototype.testUnreserved6 = function() {253 assertEquals("testUnreserved6", unreserved.parseString("~"), ["~"]);254}255TestCombinatorParser.prototype.testXXX = function() {256 assertEquals("testXXX", 4, 2+2);257}258// Expose functions at global level of frame for JSUnit259// JSUnit page setup260function setUpPage() {261 info("setUpPage", "TestCombinatorParser");262 setUpPageForJSUnit(TestCombinatorParser, this);263}264// Return list of tests for JSunit265exposeTestFunctionNames = TestCombinatorParser.exposeTestFunctionNames;...

Full Screen

Full Screen

Automation Testing Tutorials

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.

LambdaTest Learning Hubs:

YouTube

You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.

Run autotest automation tests on LambdaTest cloud grid

Perform automation testing on 3000+ real desktop and mobile devices online.

Try LambdaTest Now !!

Get 100 minutes of automation test minutes FREE!!

Next-Gen App & Browser Testing Cloud

Was this article helpful?

Helpful

NotHelpful