How to use isObject method in storybook-root

Best JavaScript code snippet using storybook-root

scrubber-test.js

Source:scrubber-test.js Github

copy

Full Screen

...25 topic: function() {26 return require("../lib/scrubber");27 },28 "it works": function(stamper) {29 assert.isObject(stamper);30 },31 "and we get its Scrubber export": {32 topic: function(scrubber) {33 return scrubber.Scrubber;34 },35 "it exists": function(Scrubber) {36 assert.isObject(Scrubber);37 },38 "it has a scrub() method": function(Scrubber) {39 assert.isFunction(Scrubber.scrub);40 },41 "it has a scrubActivity() method": function(Scrubber) {42 assert.isFunction(Scrubber.scrubActivity);43 },44 "it has a scrubObject() method": function(Scrubber) {45 assert.isFunction(Scrubber.scrubObject);46 },47 "and we scrub some dangerous text": {48 topic: function(Scrubber) {49 return Scrubber.scrub(DANGEROUS);50 },51 "it works": function(result) {52 assert.isString(result);53 assert.equal(result.indexOf("<script>"), -1);54 }55 },56 "and we scrub some innocuous text": {57 topic: function(Scrubber) {58 return Scrubber.scrub(HARMLESS);59 },60 "it works": function(result) {61 assert.isString(result);62 assert.equal(result, HARMLESS);63 }64 },65 "and we scrub an object with innocuous content": {66 topic: function(Scrubber) {67 var obj = {68 objectType: "note",69 content: HARMLESS70 };71 return Scrubber.scrubObject(obj);72 },73 "it works": function(result) {74 assert.isObject(result);75 assert.isString(result.content);76 assert.equal(result.content, HARMLESS);77 }78 },79 "and we scrub an object with dangerous content": {80 topic: function(Scrubber) {81 var obj = {82 objectType: "note",83 content: DANGEROUS84 };85 return Scrubber.scrubObject(obj);86 },87 "it works": function(result) {88 assert.isObject(result);89 assert.isString(result.content);90 assert.equal(result.content.indexOf("<script>"), -1);91 }92 },93 "and we scrub an object with innocuous summary": {94 topic: function(Scrubber) {95 var obj = {96 objectType: "note",97 summary: HARMLESS98 };99 return Scrubber.scrubObject(obj);100 },101 "it works": function(result) {102 assert.isObject(result);103 assert.isString(result.summary);104 assert.equal(result.summary, HARMLESS);105 }106 },107 "and we scrub an object with dangerous summary": {108 topic: function(Scrubber) {109 var obj = {110 objectType: "note",111 summary: DANGEROUS112 };113 return Scrubber.scrubObject(obj);114 },115 "it works": function(result) {116 assert.isObject(result);117 assert.isString(result.summary);118 assert.equal(result.summary.indexOf("<script>"), -1);119 }120 },121 "and we scrub an object with innocuous author": {122 topic: function(Scrubber) {123 var obj = {124 objectType: "note",125 author: {126 objectType: "person",127 summary: HARMLESS128 }129 };130 return Scrubber.scrubObject(obj);131 },132 "it works": function(result) {133 assert.isObject(result);134 assert.isObject(result.author);135 assert.isString(result.author.summary);136 assert.equal(result.author.summary, HARMLESS);137 }138 },139 "and we scrub an object with a dangerous author": {140 topic: function(Scrubber) {141 var obj = {142 objectType: "note",143 author: {144 objectType: "person",145 summary: DANGEROUS146 }147 };148 return Scrubber.scrubObject(obj);149 },150 "it works": function(result) {151 assert.isObject(result);152 assert.isObject(result.author);153 assert.isString(result.author.summary);154 assert.equal(result.author.summary.indexOf("<script>"), -1);155 }156 },157 "and we scrub an object with innocuous location": {158 topic: function(Scrubber) {159 var obj = {160 objectType: "note",161 location: {162 objectType: "place",163 summary: HARMLESS164 }165 };166 return Scrubber.scrubObject(obj);167 },168 "it works": function(result) {169 assert.isObject(result);170 assert.isObject(result.location);171 assert.isString(result.location.summary);172 assert.equal(result.location.summary, HARMLESS);173 }174 },175 "and we scrub an object with a dangerous location": {176 topic: function(Scrubber) {177 var obj = {178 objectType: "note",179 location: {180 objectType: "place",181 summary: DANGEROUS182 }183 };184 return Scrubber.scrubObject(obj);185 },186 "it works": function(result) {187 assert.isObject(result);188 assert.isObject(result.location);189 assert.isString(result.location.summary);190 assert.equal(result.location.summary.indexOf("<script>"), -1);191 }192 },193 "and we scrub an object with innocuous attachments": {194 topic: function(Scrubber) {195 var obj = {196 objectType: "note",197 attachments: [198 {199 objectType: "image",200 summary: HARMLESS201 },202 {203 objectType: "image",204 summary: HARMLESS205 }206 ]207 };208 return Scrubber.scrubObject(obj);209 },210 "it works": function(result) {211 assert.isObject(result);212 assert.isArray(result.attachments);213 assert.lengthOf(result.attachments, 2);214 assert.isObject(result.attachments[0]);215 assert.isObject(result.attachments[1]);216 assert.isString(result.attachments[0].summary);217 assert.isString(result.attachments[1].summary);218 assert.equal(result.attachments[0].summary, HARMLESS);219 assert.equal(result.attachments[1].summary, HARMLESS);220 }221 },222 "and we scrub an object with dangerous attachments": {223 topic: function(Scrubber) {224 var obj = {225 objectType: "note",226 attachments: [227 {228 objectType: "image",229 summary: DANGEROUS230 },231 {232 objectType: "image",233 summary: DANGEROUS234 }235 ]236 };237 return Scrubber.scrubObject(obj);238 },239 "it works": function(result) {240 assert.isObject(result);241 assert.isArray(result.attachments);242 assert.lengthOf(result.attachments, 2);243 assert.isObject(result.attachments[0]);244 assert.isObject(result.attachments[1]);245 assert.isString(result.attachments[0].summary);246 assert.isString(result.attachments[1].summary);247 assert.equal(result.attachments[0].summary.indexOf("<script>"), -1);248 assert.equal(result.attachments[1].summary.indexOf("<script>"), -1);249 }250 },251 "and we scrub an object with innocuous tags": {252 topic: function(Scrubber) {253 var obj = {254 objectType: "note",255 tags: [256 {257 objectType: "image",258 summary: HARMLESS259 },260 {261 objectType: "image",262 summary: HARMLESS263 }264 ]265 };266 return Scrubber.scrubObject(obj);267 },268 "it works": function(result) {269 assert.isObject(result);270 assert.isArray(result.tags);271 assert.lengthOf(result.tags, 2);272 assert.isObject(result.tags[0]);273 assert.isObject(result.tags[1]);274 assert.isString(result.tags[0].summary);275 assert.isString(result.tags[1].summary);276 assert.equal(result.tags[0].summary, HARMLESS);277 assert.equal(result.tags[1].summary, HARMLESS);278 }279 },280 "and we scrub an object with dangerous tags": {281 topic: function(Scrubber) {282 var obj = {283 objectType: "note",284 tags: [285 {286 objectType: "image",287 summary: DANGEROUS288 },289 {290 objectType: "image",291 summary: DANGEROUS292 }293 ]294 };295 return Scrubber.scrubObject(obj);296 },297 "it works": function(result) {298 assert.isObject(result);299 assert.isArray(result.tags);300 assert.lengthOf(result.tags, 2);301 assert.isObject(result.tags[0]);302 assert.isObject(result.tags[1]);303 assert.isString(result.tags[0].summary);304 assert.isString(result.tags[1].summary);305 assert.equal(result.tags[0].summary.indexOf("<script>"), -1);306 assert.equal(result.tags[1].summary.indexOf("<script>"), -1);307 }308 },309 "and we scrub an activity with innocuous content": {310 topic: function(Scrubber) {311 var act = {312 actor: {313 objectType: "person",314 displayName: "Anonymous"315 },316 verb: "post",317 content: HARMLESS,318 object: {319 objectType: "note",320 content: "Hello, world!"321 }322 };323 return Scrubber.scrubActivity(act);324 },325 "it works": function(result) {326 assert.isObject(result);327 assert.isString(result.content);328 assert.equal(result.content, HARMLESS);329 }330 },331 "and we scrub an activity with dangerous content": {332 topic: function(Scrubber) {333 var act = {334 actor: {335 objectType: "person",336 displayName: "Anonymous"337 },338 verb: "post",339 content: DANGEROUS,340 object: {341 objectType: "note",342 content: "Hello, world!"343 }344 };345 return Scrubber.scrubActivity(act);346 },347 "it works": function(result) {348 assert.isObject(result);349 assert.isString(result.content);350 assert.equal(result.content.indexOf("<script>"), -1);351 }352 },353 "and we scrub an activity with innocuous actor": {354 topic: function(Scrubber) {355 var act = {356 actor: {357 objectType: "person",358 displayName: "Anonymous",359 summary: HARMLESS360 },361 verb: "post",362 content: "Anonymous posted a note",363 object: {364 objectType: "note",365 content: "Hello, world!"366 }367 };368 return Scrubber.scrubActivity(act);369 },370 "it works": function(result) {371 assert.isObject(result);372 assert.isObject(result.actor);373 assert.isString(result.actor.summary);374 assert.equal(result.actor.summary, HARMLESS);375 }376 },377 "and we scrub an activity with dangerous actor": {378 topic: function(Scrubber) {379 var act = {380 actor: {381 objectType: "person",382 displayName: "Anonymous",383 summary: DANGEROUS384 },385 verb: "post",386 content: "Anonymous posted a note",387 object: {388 objectType: "note",389 content: "Hello, world!"390 }391 };392 return Scrubber.scrubActivity(act);393 },394 "it works": function(result) {395 assert.isObject(result);396 assert.isObject(result.actor);397 assert.isString(result.actor.summary);398 assert.equal(result.actor.summary.indexOf("<script>"), -1);399 }400 },401 "and we scrub an activity with innocuous object": {402 topic: function(Scrubber) {403 var act = {404 actor: {405 objectType: "person",406 displayName: "Anonymous",407 summary: HARMLESS408 },409 verb: "post",410 content: "Anonymous posted a note",411 object: {412 objectType: "note",413 content: HARMLESS414 }415 };416 return Scrubber.scrubActivity(act);417 },418 "it works": function(result) {419 assert.isObject(result);420 assert.isObject(result.object);421 assert.isString(result.object.content);422 assert.equal(result.object.content, HARMLESS);423 }424 },425 "and we scrub an activity with dangerous object": {426 topic: function(Scrubber) {427 var act = {428 actor: {429 objectType: "person",430 displayName: "Anonymous"431 },432 verb: "post",433 content: "Anonymous posted a note",434 object: {435 objectType: "note",436 content: DANGEROUS437 }438 };439 return Scrubber.scrubActivity(act);440 },441 "it works": function(result) {442 assert.isObject(result);443 assert.isObject(result.object);444 assert.isString(result.object.content);445 assert.equal(result.object.content.indexOf("<script>"), -1);446 }447 },448 "and we scrub an activity with innocuous target": {449 topic: function(Scrubber) {450 var act = {451 actor: {452 objectType: "person",453 displayName: "Anonymous"454 },455 verb: "post",456 content: "Anonymous posted a note",457 object: {458 objectType: "note",459 content: "Hello, world!"460 },461 target: {462 id: "urn:uuid:b9b0a2b4-96b8-463a-8941-708210ef202b",463 objectType: "collection",464 summary: HARMLESS465 }466 };467 return Scrubber.scrubActivity(act);468 },469 "it works": function(result) {470 assert.isObject(result);471 assert.isObject(result.target);472 assert.isString(result.target.summary);473 assert.equal(result.target.summary, HARMLESS);474 }475 },476 "and we scrub an activity with dangerous target": {477 topic: function(Scrubber) {478 var act = {479 actor: {480 objectType: "person",481 displayName: "Anonymous"482 },483 verb: "post",484 content: "Anonymous posted a note",485 object: {486 objectType: "note",487 content: "Hello, world!"488 },489 target: {490 id: "urn:uuid:90528c00-ec91-4d27-880b-46ae3c374619",491 objectType: "collection",492 summary: DANGEROUS493 }494 };495 return Scrubber.scrubActivity(act);496 },497 "it works": function(result) {498 assert.isObject(result);499 assert.isObject(result.target);500 assert.isString(result.target.summary);501 assert.equal(result.target.summary.indexOf("<script>"), -1);502 }503 },504 "and we scrub an activity with innocuous generator": {505 topic: function(Scrubber) {506 var act = {507 actor: {508 objectType: "person",509 displayName: "Anonymous"510 },511 verb: "post",512 content: "Anonymous posted a note",513 object: {514 objectType: "note",515 content: "Hello, world!"516 },517 generator: {518 objectType: "application",519 summary: HARMLESS520 }521 };522 return Scrubber.scrubActivity(act);523 },524 "it works": function(result) {525 assert.isObject(result);526 assert.isObject(result.generator);527 assert.isString(result.generator.summary);528 assert.equal(result.generator.summary, HARMLESS);529 }530 },531 "and we scrub an activity with dangerous generator": {532 topic: function(Scrubber) {533 var act = {534 actor: {535 objectType: "person",536 displayName: "Anonymous"537 },538 verb: "post",539 content: "Anonymous posted a note",540 object: {541 objectType: "note",542 content: "Hello, world!"543 },544 generator: {545 objectType: "application",546 summary: DANGEROUS547 }548 };549 return Scrubber.scrubActivity(act);550 },551 "it works": function(result) {552 assert.isObject(result);553 assert.isObject(result.generator);554 assert.isString(result.generator.summary);555 assert.equal(result.generator.summary.indexOf("<script>"), -1);556 }557 },558 "and we scrub an activity with innocuous provider": {559 topic: function(Scrubber) {560 var act = {561 actor: {562 objectType: "person",563 displayName: "Anonymous"564 },565 verb: "post",566 content: "Anonymous posted a note",567 object: {568 objectType: "note",569 content: "Hello, world!"570 },571 provider: {572 objectType: "application",573 summary: HARMLESS574 }575 };576 return Scrubber.scrubActivity(act);577 },578 "it works": function(result) {579 assert.isObject(result);580 assert.isObject(result.provider);581 assert.isString(result.provider.summary);582 assert.equal(result.provider.summary, HARMLESS);583 }584 },585 "and we scrub an activity with dangerous provider": {586 topic: function(Scrubber) {587 var act = {588 actor: {589 objectType: "person",590 displayName: "Anonymous"591 },592 verb: "post",593 content: "Anonymous posted a note",594 object: {595 objectType: "note",596 content: "Hello, world!"597 },598 provider: {599 objectType: "application",600 summary: DANGEROUS601 }602 };603 return Scrubber.scrubActivity(act);604 },605 "it works": function(result) {606 assert.isObject(result);607 assert.isObject(result.provider);608 assert.isString(result.provider.summary);609 assert.equal(result.provider.summary.indexOf("<script>"), -1);610 }611 },612 "and we scrub an activity with innocuous context": {613 topic: function(Scrubber) {614 var act = {615 actor: {616 objectType: "person",617 displayName: "Anonymous"618 },619 verb: "post",620 content: "Anonymous posted a note",621 object: {622 objectType: "note",623 content: "Hello, world!"624 },625 context: {626 objectType: "event",627 summary: HARMLESS628 }629 };630 return Scrubber.scrubActivity(act);631 },632 "it works": function(result) {633 assert.isObject(result);634 assert.isObject(result.context);635 assert.isString(result.context.summary);636 assert.equal(result.context.summary, HARMLESS);637 }638 },639 "and we scrub an activity with dangerous context": {640 topic: function(Scrubber) {641 var act = {642 actor: {643 objectType: "person",644 displayName: "Anonymous"645 },646 verb: "post",647 content: "Anonymous posted a note",648 object: {649 objectType: "note",650 content: "Hello, world!"651 },652 context: {653 objectType: "event",654 summary: DANGEROUS655 }656 };657 return Scrubber.scrubActivity(act);658 },659 "it works": function(result) {660 assert.isObject(result);661 assert.isObject(result.context);662 assert.isString(result.context.summary);663 assert.equal(result.context.summary.indexOf("<script>"), -1);664 }665 },666 "and we scrub an activity with innocuous source": {667 topic: function(Scrubber) {668 var act = {669 actor: {670 objectType: "person",671 displayName: "Anonymous"672 },673 verb: "post",674 content: "Anonymous posted a note",675 object: {676 objectType: "note",677 content: "Hello, world!"678 },679 source: {680 objectType: "collection",681 summary: HARMLESS682 }683 };684 return Scrubber.scrubActivity(act);685 },686 "it works": function(result) {687 assert.isObject(result);688 assert.isObject(result.source);689 assert.isString(result.source.summary);690 assert.equal(result.source.summary, HARMLESS);691 }692 },693 "and we scrub an activity with dangerous source": {694 topic: function(Scrubber) {695 var act = {696 actor: {697 objectType: "person",698 displayName: "Anonymous"699 },700 verb: "post",701 content: "Anonymous posted a note",702 object: {703 objectType: "note",704 content: "Hello, world!"705 },706 source: {707 objectType: "collection",708 summary: DANGEROUS709 }710 };711 return Scrubber.scrubActivity(act);712 },713 "it works": function(result) {714 assert.isObject(result);715 assert.isObject(result.source);716 assert.isString(result.source.summary);717 assert.equal(result.source.summary.indexOf("<script>"), -1);718 }719 },720 "and we scrub an activity with innocuous 'to' recipients": {721 topic: function(Scrubber) {722 var act = {723 actor: {724 objectType: "person",725 displayName: "Anonymous"726 },727 verb: "post",728 content: "Anonymous posted a note",729 object: {730 objectType: "note",731 content: "Hello, world!"732 },733 to: [734 {735 objectType: "person",736 summary: HARMLESS737 },738 {739 objectType: "person",740 summary: HARMLESS741 }742 ]743 };744 return Scrubber.scrubActivity(act);745 },746 "it works": function(result) {747 assert.isObject(result);748 assert.isObject(result);749 assert.isArray(result.to);750 assert.lengthOf(result.to, 2);751 assert.isObject(result.to[0]);752 assert.isObject(result.to[1]);753 assert.isString(result.to[0].summary);754 assert.isString(result.to[1].summary);755 assert.equal(result.to[0].summary, HARMLESS);756 assert.equal(result.to[1].summary, HARMLESS);757 }758 },759 "and we scrub an activity with dangerous 'to' recipients": {760 topic: function(Scrubber) {761 var act = {762 actor: {763 objectType: "person",764 displayName: "Anonymous"765 },766 verb: "post",767 content: "Anonymous posted a note",768 object: {769 objectType: "note",770 content: "Hello, world!"771 },772 to: [773 {774 objectType: "person",775 summary: DANGEROUS776 },777 {778 objectType: "person",779 summary: DANGEROUS780 }781 ]782 };783 return Scrubber.scrubActivity(act);784 },785 "it works": function(result) {786 assert.isObject(result);787 assert.isObject(result);788 assert.isArray(result.to);789 assert.lengthOf(result.to, 2);790 assert.isObject(result.to[0]);791 assert.isObject(result.to[1]);792 assert.isString(result.to[0].summary);793 assert.isString(result.to[1].summary);794 assert.equal(result.to[0].summary.indexOf('<script>'), -1);795 assert.equal(result.to[1].summary.indexOf('<script>'), -1);796 }797 },798 "and we scrub an activity with innocuous 'cc' recipients": {799 topic: function(Scrubber) {800 var act = {801 actor: {802 objectType: "person",803 displayName: "Anonymous"804 },805 verb: "post",806 content: "Anonymous posted a note",807 object: {808 objectType: "note",809 content: "Hello, world!"810 },811 cc: [812 {813 objectType: "person",814 summary: HARMLESS815 },816 {817 objectType: "person",818 summary: HARMLESS819 }820 ]821 };822 return Scrubber.scrubActivity(act);823 },824 "it works": function(result) {825 assert.isObject(result);826 assert.isObject(result);827 assert.isArray(result.cc);828 assert.lengthOf(result.cc, 2);829 assert.isObject(result.cc[0]);830 assert.isObject(result.cc[1]);831 assert.isString(result.cc[0].summary);832 assert.isString(result.cc[1].summary);833 assert.equal(result.cc[0].summary, HARMLESS);834 assert.equal(result.cc[1].summary, HARMLESS);835 }836 },837 "and we scrub an activity with dangerous 'cc' recipients": {838 topic: function(Scrubber) {839 var act = {840 actor: {841 objectType: "person",842 displayName: "Anonymous"843 },844 verb: "post",845 content: "Anonymous posted a note",846 object: {847 objectType: "note",848 content: "Hello, world!"849 },850 cc: [851 {852 objectType: "person",853 summary: DANGEROUS854 },855 {856 objectType: "person",857 summary: DANGEROUS858 }859 ]860 };861 return Scrubber.scrubActivity(act);862 },863 "it works": function(result) {864 assert.isObject(result);865 assert.isObject(result);866 assert.isArray(result.cc);867 assert.lengthOf(result.cc, 2);868 assert.isObject(result.cc[0]);869 assert.isObject(result.cc[1]);870 assert.isString(result.cc[0].summary);871 assert.isString(result.cc[1].summary);872 assert.equal(result.cc[0].summary.indexOf('<script>'), -1);873 assert.equal(result.cc[1].summary.indexOf('<script>'), -1);874 }875 },876 "and we scrub an activity with innocuous 'bto' recipients": {877 topic: function(Scrubber) {878 var act = {879 actor: {880 objectType: "person",881 displayName: "Anonymous"882 },883 verb: "post",884 content: "Anonymous posted a note",885 object: {886 objectType: "note",887 content: "Hello, world!"888 },889 bto: [890 {891 objectType: "person",892 summary: HARMLESS893 },894 {895 objectType: "person",896 summary: HARMLESS897 }898 ]899 };900 return Scrubber.scrubActivity(act);901 },902 "it works": function(result) {903 assert.isObject(result);904 assert.isObject(result);905 assert.isArray(result.bto);906 assert.lengthOf(result.bto, 2);907 assert.isObject(result.bto[0]);908 assert.isObject(result.bto[1]);909 assert.isString(result.bto[0].summary);910 assert.isString(result.bto[1].summary);911 assert.equal(result.bto[0].summary, HARMLESS);912 assert.equal(result.bto[1].summary, HARMLESS);913 }914 },915 "and we scrub an activity with dangerous 'bto' recipients": {916 topic: function(Scrubber) {917 var act = {918 actor: {919 objectType: "person",920 displayName: "Anonymous"921 },922 verb: "post",923 content: "Anonymous posted a note",924 object: {925 objectType: "note",926 content: "Hello, world!"927 },928 bto: [929 {930 objectType: "person",931 summary: DANGEROUS932 },933 {934 objectType: "person",935 summary: DANGEROUS936 }937 ]938 };939 return Scrubber.scrubActivity(act);940 },941 "it works": function(result) {942 assert.isObject(result);943 assert.isObject(result);944 assert.isArray(result.bto);945 assert.lengthOf(result.bto, 2);946 assert.isObject(result.bto[0]);947 assert.isObject(result.bto[1]);948 assert.isString(result.bto[0].summary);949 assert.isString(result.bto[1].summary);950 assert.equal(result.bto[0].summary.indexOf('<script>'), -1);951 assert.equal(result.bto[1].summary.indexOf('<script>'), -1);952 }953 },954 "and we scrub an activity with innocuous 'bcc' recipients": {955 topic: function(Scrubber) {956 var act = {957 actor: {958 objectType: "person",959 displayName: "Anonymous"960 },961 verb: "post",962 content: "Anonymous posted a note",963 object: {964 objectType: "note",965 content: "Hello, world!"966 },967 bcc: [968 {969 objectType: "person",970 summary: HARMLESS971 },972 {973 objectType: "person",974 summary: HARMLESS975 }976 ]977 };978 return Scrubber.scrubActivity(act);979 },980 "it works": function(result) {981 assert.isObject(result);982 assert.isObject(result);983 assert.isArray(result.bcc);984 assert.lengthOf(result.bcc, 2);985 assert.isObject(result.bcc[0]);986 assert.isObject(result.bcc[1]);987 assert.isString(result.bcc[0].summary);988 assert.isString(result.bcc[1].summary);989 assert.equal(result.bcc[0].summary, HARMLESS);990 assert.equal(result.bcc[1].summary, HARMLESS);991 }992 },993 "and we scrub an activity with dangerous 'bcc' recipients": {994 topic: function(Scrubber) {995 var act = {996 actor: {997 objectType: "person",998 displayName: "Anonymous"999 },1000 verb: "post",1001 content: "Anonymous posted a note",1002 object: {1003 objectType: "note",1004 content: "Hello, world!"1005 },1006 bcc: [1007 {1008 objectType: "person",1009 summary: DANGEROUS1010 },1011 {1012 objectType: "person",1013 summary: DANGEROUS1014 }1015 ]1016 };1017 return Scrubber.scrubActivity(act);1018 },1019 "it works": function(result) {1020 assert.isObject(result);1021 assert.isObject(result);1022 assert.isArray(result.bcc);1023 assert.lengthOf(result.bcc, 2);1024 assert.isObject(result.bcc[0]);1025 assert.isObject(result.bcc[1]);1026 assert.isString(result.bcc[0].summary);1027 assert.isString(result.bcc[1].summary);1028 assert.equal(result.bcc[0].summary.indexOf('<script>'), -1);1029 assert.equal(result.bcc[1].summary.indexOf('<script>'), -1);1030 }1031 },1032 "and we scrub an activity with private members": {1033 topic: function(Scrubber) {1034 var act = {1035 _uuid: "MADEUP",1036 actor: {1037 objectType: "person",1038 displayName: "Anonymous"1039 },1040 verb: "post",1041 content: "Anonymous posted a note",1042 object: {1043 objectType: "note",1044 content: "Hello, world!"1045 }1046 };1047 return Scrubber.scrubActivity(act);1048 },1049 "it works": function(result) {1050 assert.isObject(result);1051 assert.isFalse(_.has(result, "_uuid"));1052 }1053 },1054 "and we scrub an activity with an actor with private members": {1055 topic: function(Scrubber) {1056 var act = {1057 actor: {1058 objectType: "person",1059 displayName: "Anonymous",1060 _user: true1061 },1062 verb: "post",1063 content: "Anonymous posted a note",1064 object: {1065 objectType: "note",1066 content: "Hello, world!"1067 }1068 };1069 return Scrubber.scrubActivity(act);1070 },1071 "it works": function(result) {1072 assert.isObject(result);1073 assert.isObject(result.actor);1074 assert.isFalse(_.has(result.actor, "_user"));1075 }1076 },1077 "and we scrub an activity with an object with private members": {1078 topic: function(Scrubber) {1079 var act = {1080 actor: {1081 objectType: "person",1082 displayName: "Anonymous"1083 },1084 verb: "post",1085 content: "Anonymous posted a note",1086 object: {1087 objectType: "note",1088 content: "Hello, world!",1089 _uuid: true1090 }1091 };1092 return Scrubber.scrubActivity(act);1093 },1094 "it works": function(result) {1095 assert.isObject(result);1096 assert.isObject(result.object);1097 assert.isFalse(_.has(result.object, "_uuid"));1098 }1099 }1100 }1101 }...

Full Screen

Full Screen

distributor-remote-test-as-root.js

Source:distributor-remote-test-as-root.js Github

copy

Full Screen

...76 );77 },78 "it works": function(err, cred1, cred2) {79 assert.ifError(err);80 assert.isObject(cred1);81 assert.isObject(cred2);82 },83 "and one user follows the other": {84 topic: function(cred1, cred2) {85 var url = "http://social.localhost/api/user/maven/feed",86 act = {87 verb: "follow",88 object: {89 id: "acct:photog@photo.localhost",90 objectType: "person"91 }92 },93 callback = this.callback;94 95 pj(url, cred1, act, function(err, body, resp) {96 if (err) {97 callback(err, null);98 } else {99 callback(null, body);100 }101 });102 },103 "it works": function(err, body) {104 assert.ifError(err);105 assert.isObject(body);106 },107 "and we wait a few seconds for delivery": {108 topic: function() {109 var callback = this.callback;110 setTimeout(function() { callback(null); }, 5000);111 },112 "it works": function(err) {113 assert.ifError(err);114 },115 "and we check the first user's following list": {116 topic: function(act, cred1, cred2) {117 var url = "http://social.localhost/api/user/maven/following",118 callback = this.callback;119 120 gj(url, cred1, function(err, body, resp) {121 if (err) {122 callback(err, null);123 } else {124 callback(null, body);125 }126 });127 },128 "it works": function(err, feed) {129 assert.ifError(err);130 assert.isObject(feed);131 },132 "it includes the second user": function(err, feed) {133 assert.ifError(err);134 assert.isObject(feed);135 assert.include(feed, "items");136 assert.isArray(feed.items);137 assert.greater(feed.items.length, 0);138 assert.isObject(_.find(feed.items, function(item) { return item.id == "acct:photog@photo.localhost" }));139 }140 },141 "and we check the second user's followers list": {142 topic: function(act, cred1, cred2) {143 var url = "http://photo.localhost/api/user/photog/followers",144 callback = this.callback;145 gj(url, cred2, function(err, body, resp) {146 if (err) {147 callback(err, null);148 } else {149 callback(null, body);150 }151 });152 },153 "it works": function(err, feed) {154 var maven;155 assert.ifError(err);156 assert.isObject(feed);157 assert.include(feed, "items");158 assert.isArray(feed.items);159 assert.greater(feed.items.length, 0);160 assert.isObject(feed.items[0]);161 maven = feed.items[0];162 assert.include(maven, "id");163 assert.equal(maven.id, "acct:maven@social.localhost");164 assert.include(maven, "followers");165 assert.isObject(maven.followers);166 assert.include(maven.followers, "url");167 assert.equal(serverOf(maven.followers.url), "social.localhost");168 assert.include(maven, "following");169 assert.isObject(maven.following);170 assert.include(maven.following, "url");171 assert.equal(serverOf(maven.following.url), "social.localhost");172 assert.include(maven, "favorites");173 assert.isObject(maven.favorites);174 assert.include(maven.favorites, "url");175 assert.equal(serverOf(maven.favorites.url), "social.localhost");176 assert.include(maven, "lists");177 assert.isObject(maven.lists);178 assert.include(maven.lists, "url");179 assert.equal(serverOf(maven.lists.url), "social.localhost");180 assert.include(maven, "links");181 assert.isObject(maven.links);182 assert.include(maven.links, "self");183 assert.isObject(maven.links.self);184 assert.include(maven.links.self, "href");185 assert.equal(serverOf(maven.links.self.href), "social.localhost");186 assert.include(maven.links, "activity-inbox");187 assert.isObject(maven.links["activity-inbox"]);188 assert.include(maven.links["activity-inbox"], "href");189 assert.equal(serverOf(maven.links["activity-inbox"].href), "social.localhost");190 assert.include(maven.links, "self");191 assert.isObject(maven.links["activity-outbox"]);192 assert.include(maven.links["activity-outbox"], "href");193 assert.equal(serverOf(maven.links["activity-outbox"].href), "social.localhost");194 }195 },196 "and we check the second user's inbox": {197 topic: function(act, cred1, cred2) {198 var url = "http://photo.localhost/api/user/photog/inbox",199 callback = this.callback;200 201 gj(url, cred2, function(err, feed, resp) {202 if (err) {203 callback(err, null, null);204 } else {205 callback(null, feed, act);206 }207 });208 },209 "it works": function(err, feed, act) {210 assert.ifError(err);211 assert.isObject(feed);212 assert.isObject(act);213 },214 "it includes the activity": function(err, feed, act) {215 assert.ifError(err);216 assert.isObject(feed);217 assert.isObject(act);218 assert.include(feed, "items");219 assert.isArray(feed.items);220 assert.greater(feed.items.length, 0);221 assert.isObject(_.find(feed.items, function(item) { return item.id == act.id; }));222 }223 },224 "and the second user posts an image": {225 topic: function(act, cred1, cred2) {226 var url = "http://photo.localhost/api/user/photog/feed",227 callback = this.callback,228 post = {229 verb: "post",230 object: {231 objectType: "image",232 displayName: "My Photo"233 }234 };235 236 pj(url, cred2, post, function(err, act, resp) {237 if (err) {238 callback(err, null);239 } else {240 callback(null, act);241 }242 });243 },244 "it works": function(err, act) {245 assert.ifError(err);246 assert.isObject(act);247 },248 "and we wait a few seconds for delivery": {249 topic: function() {250 var callback = this.callback;251 setTimeout(function() { callback(null); }, 5000);252 },253 "it works": function(err) {254 assert.ifError(err);255 },256 "and we check the first user's inbox": {257 topic: function(posted, followed, cred1, cred2) {258 var callback = this.callback,259 url = "http://social.localhost/api/user/maven/inbox";260 gj(url, cred1, function(err, feed, resp) {261 if (err) {262 callback(err, null, null);263 } else {264 callback(null, feed, posted);265 }266 });267 },268 "it works": function(err, feed, act) {269 assert.ifError(err);270 assert.isObject(feed);271 assert.isObject(act);272 },273 "it includes the activity": function(err, feed, act) {274 assert.ifError(err);275 assert.isObject(feed);276 assert.isObject(act);277 assert.include(feed, "items");278 assert.isArray(feed.items);279 assert.greater(feed.items.length, 0);280 assert.isObject(_.find(feed.items, function(item) { return item.id == act.id; }));281 },282 "activity is sanitized": function(err, feed, act) {283 var item;284 assert.ifError(err);285 assert.isObject(feed);286 assert.isArray(feed.items);287 assert.greater(feed.items.length, 0);288 item = _.find(feed.items, function(item) { return item.id == act.id; });289 assert.isObject(item);290 assert.isObject(item.actor);291 assert.isFalse(_(item.actor).has("_user"));292 },293 "activity likes and replies feeds have right host": function(err, feed, act) {294 var item;295 assert.ifError(err);296 assert.isObject(feed);297 assert.isArray(feed.items);298 assert.greater(feed.items.length, 0);299 item = _.find(feed.items, function(item) { return item.id == act.id; });300 assert.isObject(item);301 assert.isObject(item.object);302 assert.isObject(item.object.likes);303 assert.isString(item.object.likes.url);304 assert.equal(serverOf(item.object.likes.url), "photo.localhost");305 assert.isObject(item.object.replies);306 assert.isString(item.object.replies.url);307 assert.equal(serverOf(item.object.replies.url), "photo.localhost");308 }309 },310 "and the first user responds": {311 topic: function(posted, followed, cred1, cred2) {312 var callback = this.callback,313 url = "http://social.localhost/api/user/maven/feed",314 postComment = {315 verb: "post",316 object: {317 objectType: "comment",318 inReplyTo: posted.object,319 content: "Nice one!"320 }321 };322 pj(url, cred1, postComment, function(err, pc, resp) {323 if (err) {324 callback(err, null);325 } else {326 callback(null, pc);327 }328 });329 },330 "it works": function(err, pc) {331 assert.ifError(err);332 assert.isObject(pc);333 },334 "and we wait a few seconds for delivery": {335 topic: function() {336 var callback = this.callback;337 setTimeout(function() { callback(null); }, 5000);338 },339 "it works": function(err) {340 assert.ifError(err);341 },342 "and we check the second user's inbox": {343 topic: function(pc, pi, fu, cred1, cred2) {344 var url = "http://photo.localhost/api/user/photog/inbox",345 callback = this.callback;346 347 gj(url, cred2, function(err, feed, resp) {348 if (err) {349 callback(err, null, null);350 } else {351 callback(null, feed, pc);352 }353 });354 },355 "it works": function(err, feed, act) {356 assert.ifError(err);357 assert.isObject(feed);358 assert.isObject(act);359 },360 "it includes the activity": function(err, feed, act) {361 var item;362 assert.ifError(err);363 assert.isObject(feed);364 assert.isObject(act);365 assert.include(feed, "items");366 assert.isArray(feed.items);367 assert.greater(feed.items.length, 0);368 item = _.find(feed.items, function(item) { return item.id == act.id; });369 assert.isObject(item);370 }371 },372 "and we check the image's replies": {373 topic: function(pc, pi, fu, cred1, cred2) {374 var url = pi.object.replies.url,375 callback = this.callback;376 377 gj(url, cred2, function(err, feed, resp) {378 if (err) {379 callback(err, null, null);380 } else {381 callback(null, feed, pc);382 }383 });384 },385 "it works": function(err, feed, pc) {386 assert.ifError(err);387 assert.isObject(feed);388 },389 "feed includes the comment": function(err, feed, pc) {390 var item;391 assert.ifError(err);392 assert.isObject(feed);393 assert.isObject(pc);394 assert.include(feed, "items");395 assert.isArray(feed.items);396 assert.greater(feed.items.length, 0);397 item = _.find(feed.items, function(item) { return item.id == pc.object.id; });398 assert.isObject(item);399 }400 },401 "and the second user likes the comment": {402 topic: function(pc, pi, fu, cred1, cred2) {403 var url = "http://photo.localhost/api/user/photog/feed",404 callback = this.callback,405 post = {406 verb: "favorite",407 object: pc.object408 };409 410 pj(url, cred2, post, function(err, act, resp) {411 if (err) {412 callback(err, null);413 } else {414 callback(null, act);415 }416 });417 },418 "it works": function(err, act) {419 assert.ifError(err);420 assert.isObject(act);421 },422 "and we wait a few seconds for delivery": {423 topic: function() {424 var callback = this.callback;425 setTimeout(function() { callback(null); }, 5000);426 },427 "it works": function(err) {428 assert.ifError(err);429 },430 "and we check the first user's inbox": {431 topic: function(fc, pc, pi, fu, cred1, cred2) {432 var callback = this.callback,433 url = "http://social.localhost/api/user/maven/inbox";434 gj(url, cred1, function(err, feed, resp) {435 if (err) {436 callback(err, null, null);437 } else {438 callback(null, feed, fc);439 }440 });441 },442 "it works": function(err, feed, act) {443 assert.ifError(err);444 assert.isObject(feed);445 assert.isObject(act);446 },447 "it includes the activity": function(err, feed, act) {448 assert.ifError(err);449 assert.isObject(feed);450 assert.isObject(act);451 assert.include(feed, "items");452 assert.isArray(feed.items);453 assert.greater(feed.items.length, 0);454 item = _.find(feed.items, function(item) { return item.id == act.id; });455 assert.isObject(item);456 }457 },458 "and we check the comment's likes feed": {459 topic: function(fc, pc, pi, fu, cred1, cred2) {460 var url = pc.object.likes.url,461 callback = this.callback;462 463 gj(url, cred1, function(err, feed, resp) {464 if (err) {465 callback(err, null, null);466 } else {467 callback(null, feed, fc);468 }469 });470 },471 "it works": function(err, feed, fc) {472 assert.ifError(err);473 assert.isObject(feed);474 },475 "feed includes the second user": function(err, feed, fc) {476 var item;477 assert.ifError(err);478 assert.isObject(feed);479 assert.isObject(fc);480 assert.include(feed, "items");481 assert.isArray(feed.items);482 assert.greater(feed.items.length, 0);483 item = _.find(feed.items, function(item) { return item.id == fc.actor.id; });484 assert.isObject(item);485 }486 }487 }488 }489 }490 }491 }492 }493 }494 }495 }496 }497});498suite["export"](module);

Full Screen

Full Screen

testStandards.js

Source:testStandards.js Github

copy

Full Screen

...3// these tests are enforcing parity with IPython magics, as reported by %lsmagic (even if lots of these are stubs)4describe("standard magics", function() {5 it("%alias", function() {6 let magicObject = getMagic("%alias");7 assert.isObject(magicObject);8 });9 it("%alias_magic", function() {10 let magicObject = getMagic("%alias_magic");11 assert.isObject(magicObject);12 });13 it("%autoawait", function() {14 let magicObject = getMagic("%autoawait");15 assert.isObject(magicObject);16 });17 it("%autocall", function() {18 let magicObject = getMagic("%autocall");19 assert.isObject(magicObject);20 });21 it("%automagic", function() {22 let magicObject = getMagic("%automagic");23 assert.isObject(magicObject);24 });25 it("%autosave", function() {26 let magicObject = getMagic("%autosave");27 assert.isObject(magicObject);28 });29 it("%bookmark", function() {30 let magicObject = getMagic("%bookmark");31 assert.isObject(magicObject);32 });33 it("%cat", function() {34 let magicObject = getMagic("%cat");35 assert.isObject(magicObject);36 });37 it("%cd", function() {38 let magicObject = getMagic("%cd");39 assert.isObject(magicObject);40 });41 it("%clear", function() {42 let magicObject = getMagic("%clear");43 assert.isObject(magicObject);44 });45 it("%colors", function() {46 let magicObject = getMagic("%colors");47 assert.isObject(magicObject);48 });49 it("%conda", function() {50 let magicObject = getMagic("%conda");51 assert.isObject(magicObject);52 });53 it("%config", function() {54 let magicObject = getMagic("%config");55 assert.isObject(magicObject);56 });57 it("%connect_info", function() {58 let magicObject = getMagic("%connect_info");59 assert.isObject(magicObject);60 });61 it("%cp", function() {62 let magicObject = getMagic("%cp");63 assert.isObject(magicObject);64 });65 it("%debug", function() {66 let magicObject = getMagic("%debug");67 assert.isObject(magicObject);68 });69 it("%dhist", function() {70 let magicObject = getMagic("%dhist");71 assert.isObject(magicObject);72 });73 it("%dirs", function() {74 let magicObject = getMagic("%dirs");75 assert.isObject(magicObject);76 });77 it("%doctest_mode", function() {78 let magicObject = getMagic("%doctest_mode");79 assert.isObject(magicObject);80 });81 it("%ed", function() {82 let magicObject = getMagic("%ed");83 assert.isObject(magicObject);84 });85 it("%edit", function() {86 let magicObject = getMagic("%edit");87 assert.isObject(magicObject);88 });89 it("%env", function() {90 let magicObject = getMagic("%env");91 assert.isObject(magicObject);92 });93 it("%gui", function() {94 let magicObject = getMagic("%gui");95 assert.isObject(magicObject);96 });97 it("%hist", function() {98 let magicObject = getMagic("%hist");99 assert.isObject(magicObject);100 });101 it("%history", function() {102 let magicObject = getMagic("%history");103 assert.isObject(magicObject);104 });105 it("%killbgscripts", function() {106 let magicObject = getMagic("%killbgscripts");107 assert.isObject(magicObject);108 });109 it("%ldir", function() {110 let magicObject = getMagic("%ldir");111 assert.isObject(magicObject);112 });113 it("%less", function() {114 let magicObject = getMagic("%less");115 assert.isObject(magicObject);116 });117 it("%lf", function() {118 let magicObject = getMagic("%lf");119 assert.isObject(magicObject);120 });121 it("%lk", function() {122 let magicObject = getMagic("%lk");123 assert.isObject(magicObject);124 });125 it("%ll", function() {126 let magicObject = getMagic("%ll");127 assert.isObject(magicObject);128 });129 it("%load", function() {130 let magicObject = getMagic("%load");131 assert.isObject(magicObject);132 });133 it("%load_ext", function() {134 let magicObject = getMagic("%load_ext");135 assert.isObject(magicObject);136 });137 it("%loadpy", function() {138 let magicObject = getMagic("%loadpy");139 assert.isObject(magicObject);140 });141 it("%logoff", function() {142 let magicObject = getMagic("%logoff");143 assert.isObject(magicObject);144 });145 it("%logon", function() {146 let magicObject = getMagic("%logon");147 assert.isObject(magicObject);148 });149 it("%logstart", function() {150 let magicObject = getMagic("%logstart");151 assert.isObject(magicObject);152 });153 it("%logstate", function() {154 let magicObject = getMagic("%logstate");155 assert.isObject(magicObject);156 });157 it("%logstop", function() {158 let magicObject = getMagic("%logstop");159 assert.isObject(magicObject);160 });161 it("%ls", function() {162 let magicObject = getMagic("%ls");163 assert.isObject(magicObject);164 });165 it("%lsmagic", function() {166 let magicObject = getMagic("%lsmagic");167 assert.isObject(magicObject);168 });169 it("%lx", function() {170 let magicObject = getMagic("%lx");171 assert.isObject(magicObject);172 });173 it("%macro", function() {174 let magicObject = getMagic("%macro");175 assert.isObject(magicObject);176 });177 it("%magic", function() {178 let magicObject = getMagic("%magic");179 assert.isObject(magicObject);180 });181 it("%man", function() {182 let magicObject = getMagic("%man");183 assert.isObject(magicObject);184 });185 it("%matplotlib", function() {186 let magicObject = getMagic("%matplotlib");187 assert.isObject(magicObject);188 });189 it("%mkdir", function() {190 let magicObject = getMagic("%mkdir");191 assert.isObject(magicObject);192 });193 it("%more", function() {194 let magicObject = getMagic("%more");195 assert.isObject(magicObject);196 });197 it("%mv", function() {198 let magicObject = getMagic("%mv");199 assert.isObject(magicObject);200 });201 it("%notebook", function() {202 let magicObject = getMagic("%notebook");203 assert.isObject(magicObject);204 });205 it("%page", function() {206 let magicObject = getMagic("%page");207 assert.isObject(magicObject);208 });209 it("%pastebin", function() {210 let magicObject = getMagic("%pastebin");211 assert.isObject(magicObject);212 });213 it("%pdb", function() {214 let magicObject = getMagic("%pdb");215 assert.isObject(magicObject);216 });217 it("%pdef", function() {218 let magicObject = getMagic("%pdef");219 assert.isObject(magicObject);220 });221 it("%pdoc", function() {222 let magicObject = getMagic("%pdoc");223 assert.isObject(magicObject);224 });225 it("%pfile", function() {226 let magicObject = getMagic("%pfile");227 assert.isObject(magicObject);228 });229 it("%pinfo", function() {230 let magicObject = getMagic("%pinfo");231 assert.isObject(magicObject);232 });233 it("%pinfo2", function() {234 let magicObject = getMagic("%pinfo2");235 assert.isObject(magicObject);236 });237 it("%pip", function() {238 let magicObject = getMagic("%pip");239 assert.isObject(magicObject);240 });241 it("%popd", function() {242 let magicObject = getMagic("%popd");243 assert.isObject(magicObject);244 });245 it("%pprint", function() {246 let magicObject = getMagic("%pprint");247 assert.isObject(magicObject);248 });249 it("%precision", function() {250 let magicObject = getMagic("%precision");251 assert.isObject(magicObject);252 });253 it("%prun", function() {254 let magicObject = getMagic("%prun");255 assert.isObject(magicObject);256 });257 it("%psearch", function() {258 let magicObject = getMagic("%psearch");259 assert.isObject(magicObject);260 });261 it("%psource", function() {262 let magicObject = getMagic("%psource");263 assert.isObject(magicObject);264 });265 it("%pushd", function() {266 let magicObject = getMagic("%pushd");267 assert.isObject(magicObject);268 });269 it("%pwd", function() {270 let magicObject = getMagic("%pwd");271 assert.isObject(magicObject);272 });273 it("%pycat", function() {274 let magicObject = getMagic("%pycat");275 assert.isObject(magicObject);276 });277 it("%pylab", function() {278 let magicObject = getMagic("%pylab");279 assert.isObject(magicObject);280 });281 it("%qtconsole", function() {282 let magicObject = getMagic("%qtconsole");283 assert.isObject(magicObject);284 });285 it("%quickref", function() {286 let magicObject = getMagic("%quickref");287 assert.isObject(magicObject);288 });289 it("%recall", function() {290 let magicObject = getMagic("%recall");291 assert.isObject(magicObject);292 });293 it("%rehashx", function() {294 let magicObject = getMagic("%rehashx");295 assert.isObject(magicObject);296 });297 it("%reload_ext", function() {298 let magicObject = getMagic("%reload_ext");299 assert.isObject(magicObject);300 });301 it("%rep", function() {302 let magicObject = getMagic("%rep");303 assert.isObject(magicObject);304 });305 it("%rerun", function() {306 let magicObject = getMagic("%rerun");307 assert.isObject(magicObject);308 });309 it("%reset", function() {310 let magicObject = getMagic("%reset");311 assert.isObject(magicObject);312 });313 it("%reset_selective", function() {314 let magicObject = getMagic("%reset_selective");315 assert.isObject(magicObject);316 });317 it("%rm", function() {318 let magicObject = getMagic("%rm");319 assert.isObject(magicObject);320 });321 it("%rmdir", function() {322 let magicObject = getMagic("%rmdir");323 assert.isObject(magicObject);324 });325 it("%run", function() {326 let magicObject = getMagic("%run");327 assert.isObject(magicObject);328 });329 it("%save", function() {330 let magicObject = getMagic("%save");331 assert.isObject(magicObject);332 });333 it("%sc", function() {334 let magicObject = getMagic("%sc");335 assert.isObject(magicObject);336 });337 it("%set_env", function() {338 let magicObject = getMagic("%set_env");339 assert.isObject(magicObject);340 });341 it("%store", function() {342 let magicObject = getMagic("%store");343 assert.isObject(magicObject);344 });345 it("%sx", function() {346 let magicObject = getMagic("%sx");347 assert.isObject(magicObject);348 });349 it("%system", function() {350 let magicObject = getMagic("%system");351 assert.isObject(magicObject);352 });353 it("%tb", function() {354 let magicObject = getMagic("%tb");355 assert.isObject(magicObject);356 });357 it("%time", function() {358 let magicObject = getMagic("%time");359 assert.isObject(magicObject);360 });361 it("%timeit", function() {362 let magicObject = getMagic("%timeit");363 assert.isObject(magicObject);364 });365 it("%unalias", function() {366 let magicObject = getMagic("%unalias");367 assert.isObject(magicObject);368 });369 it("%unload_ext", function() {370 let magicObject = getMagic("%unload_ext");371 assert.isObject(magicObject);372 });373 it("%who", function() {374 let magicObject = getMagic("%who");375 assert.isObject(magicObject);376 });377 it("%who_ls", function() {378 let magicObject = getMagic("%who_ls");379 assert.isObject(magicObject);380 });381 it("%whos", function() {382 let magicObject = getMagic("%whos");383 assert.isObject(magicObject);384 });385 it("%xdel", function() {386 let magicObject = getMagic("%xdel");387 assert.isObject(magicObject);388 });389 it("%xmode", function() {390 let magicObject = getMagic("%xmode");391 assert.isObject(magicObject);392 });393 // this one is problematic because of how we think about special characters394 // it("%%!", function() {395 // let magicObject = getMagic("%%!");396 // assert.isObject(magicObject);397 // });398 it("%%HTML", function() {399 let magicObject = getMagic("%%HTML");400 assert.isObject(magicObject);401 });402 it("%%SVG", function() {403 let magicObject = getMagic("%%SVG");404 assert.isObject(magicObject);405 });406 it("%%bash", function() {407 let magicObject = getMagic("%%bash");408 assert.isObject(magicObject);409 });410 it("%%capture", function() {411 let magicObject = getMagic("%%capture");412 assert.isObject(magicObject);413 });414 it("%%debug", function() {415 let magicObject = getMagic("%%debug");416 assert.isObject(magicObject);417 });418 it("%%file", function() {419 let magicObject = getMagic("%%file");420 assert.isObject(magicObject);421 });422 it("%%html", function() {423 let magicObject = getMagic("%%html");424 assert.isObject(magicObject);425 });426 it("%%javascript", function() {427 let magicObject = getMagic("%%javascript");428 assert.isObject(magicObject);429 });430 it("%%js", function() {431 let magicObject = getMagic("%%js");432 assert.isObject(magicObject);433 });434 it("%%latex", function() {435 let magicObject = getMagic("%%latex");436 assert.isObject(magicObject);437 });438 it("%%markdown", function() {439 let magicObject = getMagic("%%markdown");440 assert.isObject(magicObject);441 });442 it("%%perl", function() {443 let magicObject = getMagic("%%perl");444 assert.isObject(magicObject);445 });446 it("%%prun", function() {447 let magicObject = getMagic("%%prun");448 assert.isObject(magicObject);449 });450 it("%%pypy", function() {451 let magicObject = getMagic("%%pypy");452 assert.isObject(magicObject);453 });454 it("%%python", function() {455 let magicObject = getMagic("%%python");456 assert.isObject(magicObject);457 });458 it("%%python2", function() {459 let magicObject = getMagic("%%python2");460 assert.isObject(magicObject);461 });462 it("%%python3", function() {463 let magicObject = getMagic("%%python3");464 assert.isObject(magicObject);465 });466 it("%%ruby", function() {467 let magicObject = getMagic("%%ruby");468 assert.isObject(magicObject);469 });470 it("%%script", function() {471 let magicObject = getMagic("%%script");472 assert.isObject(magicObject);473 });474 it("%%sh", function() {475 let magicObject = getMagic("%%sh");476 assert.isObject(magicObject);477 });478 it("%%svg", function() {479 let magicObject = getMagic("%%svg");480 assert.isObject(magicObject);481 });482 it("%%sx", function() {483 let magicObject = getMagic("%%sx");484 assert.isObject(magicObject);485 });486 it("%%system", function() {487 let magicObject = getMagic("%%system");488 assert.isObject(magicObject);489 });490 it("%%time", function() {491 let magicObject = getMagic("%%time");492 assert.isObject(magicObject);493 });494 it("%%timeit", function() {495 let magicObject = getMagic("%%timeit");496 assert.isObject(magicObject);497 });498 it("%%writefile", function() {499 let magicObject = getMagic("%%writefile");500 assert.isObject(magicObject);501 });...

Full Screen

Full Screen

fhir.integration.app-test.js

Source:fhir.integration.app-test.js Github

copy

Full Screen

...5import { Promise } from 'meteor/promise';6import { $ } from 'meteor/jquery';7runIsomorphicTests = function(){8 it('Meteor exists on client', function() {9 assert.isObject(Meteor);10 });11 it('AllergyIntolerances', function() {12 assert.isObject(AllergyIntolerances);13 });14 it('Appointments', function() {15 assert.isObject(Appointments);16 });17 it('Binarys', function() {18 assert.isObject(Binarys);19 });20 it('Bundles', function() {21 assert.isObject(Bundles);22 });23 it('CarePlans', function() {24 assert.isObject(CarePlans);25 });26 it('ClinicalImpressions', function() {27 assert.isObject(ClinicalImpressions);28 });29 it('Conditions', function() {30 assert.isObject(Conditions);31 });32 it('Coverages', function() {33 assert.isObject(Coverages);34 });35 it('Datatypes - Address', function() {36 assert.isObject(Address);37 });38 it('Datatypes - Annotation', function() {39 assert.isObject(Annotation);40 });41 it('Datatypes - Attachment', function() {42 assert.isObject(Attachment);43 });44 it('Datatypes - Code', function() {45 assert.isString(Code);46 });47 it('Datatypes - Quantity', function() {48 assert.isObject(Quantity);49 });50 it('Datatypes - HumanName', function() {51 assert.isObject(HumanName);52 });53 it('Datatypes - Reference', function() {54 assert.isObject(Reference);55 });56 it('Datatypes - Period', function() {57 assert.isObject(Period);58 });59 it('Datatypes - Coding', function() {60 assert.isObject(Coding);61 });62 it('Datatypes - CodeableConcept', function() {63 assert.isObject(CodeableConcept);64 });65 it('Datatypes - Identifier', function() {66 assert.isObject(Identifier);67 });68 it('Datatypes - ContactPoint', function() {69 assert.isObject(ContactPoint);70 });71 it('Datatypes - Group', function() {72 assert.isObject(Group);73 });74 it('Datatypes - Conformance', function() {75 assert.isObject(Conformance);76 });77 it('Datatypes - Range', function() {78 assert.isObject(Range);79 });80 it('Datatypes - Ratio', function() {81 assert.isObject(Ratio);82 });83 it('Datatypes - SampledData', function() {84 assert.isObject(SampledData);85 });86 it('Datatypes - Signature', function() {87 assert.isObject(Signature);88 });89 it('Datatypes - Timing', function() {90 assert.isObject(Timing);91 });92 it('Devices', function() {93 assert.isObject(Devices);94 });95 it('DiagnosticOrders', function() {96 assert.isObject(DiagnosticOrders);97 });98 it('DiagnosticReports', function() {99 assert.isObject(DiagnosticReports);100 });101 it('DocumentReferences', function() {102 assert.isObject(DocumentReferences);103 });104 it('Encounters', function() {105 assert.isObject(Encounters);106 });107 it('FamilyMemberHistories', function() {108 assert.isObject(FamilyMemberHistories);109 });110 it('Goals', function() {111 assert.isObject(Goals);112 });113 it('HealthcareServices', function() {114 assert.isObject(HealthcareServices);115 });116 it('ImagingStudies', function() {117 assert.isObject(ImagingStudies);118 });119 it('Immunizations', function() {120 assert.isObject(Immunizations);121 });122 it('Locations', function() {123 assert.isObject(Locations);124 });125 it('Medications', function() {126 assert.isObject(Medications);127 });128 it('MedicationOrders', function() {129 assert.isObject(MedicationOrders);130 });131 it('MedicationStatements', function() {132 assert.isObject(MedicationStatements);133 });134 it('MessageHeaders', function() {135 assert.isObject(MessageHeaders);136 });137 it('Observations', function() {138 assert.isObject(Observations);139 });140 it('Orders', function() {141 assert.isObject(Orders);142 });143 it('Organizations', function() {144 assert.isObject(Organizations);145 });146 it('Patients', function() {147 assert.isObject(Patients);148 });149 it('Persons', function() {150 assert.isObject(Persons);151 });152 it('Practitioners', function() {153 assert.isObject(Practitioners);154 });155 it('Procedures', function() {156 assert.isObject(Procedures);157 });158 it('ProcedureRequests', function() {159 assert.isObject(ProcedureRequests);160 });161 it('Questionnaires', function() {162 assert.isObject(Questionnaires);163 });164 it('QuestionnaireResponses', function() {165 assert.isObject(QuestionnaireResponses);166 });167 it('RelatedPersons', function() {168 assert.isObject(RelatedPersons);169 });170 it('RiskAssessments', function() {171 assert.isObject(RiskAssessments);172 });173 it('Schedules', function() {174 assert.isObject(Schedules);175 });176 it('Sequences', function() {177 assert.isObject(Sequences);178 });179 it('Slots', function() {180 assert.isObject(Slots);181 });182 it('Specimens', function() {183 assert.isObject(Specimens);184 });185}186if (Meteor.isClient) {187 describe('FHIR Resources exist on client', function() {188 runIsomorphicTests();189 });190}191if (Meteor.isServer) {192 describe('FHIR Resources exists on server', function() {193 runIsomorphicTests();194 });...

Full Screen

Full Screen

isObject.js

Source:isObject.js Github

copy

Full Screen

1module("baidu.lang.isObject测试");23test("Object参数", function(){4 equals(baidu.lang.isObject({}), true, 'baidu.lang.isObject({}) is true');5});67test("Function类型", function(){8 equals(baidu.lang.isObject(new Function()), true, 'baidu.lang.isObject(new Function()) is true');9});1011test("Array对象", function(){12 equals(baidu.lang.isObject([]), true, 'baidu.lang.isObject([]) is true');13});1415test("Element对象", function(){16 var oDiv = document.createElement("div"); // create div17 oDiv.id="erikElement";18 document.body.appendChild(oDiv);19 20 equals(baidu.lang.isObject(document.getElementById('erikElement')), true, 'baidu.lang.isObject(document.getElementById("erikElement")) is true');21 22 oDiv.parentNode.removeChild(oDiv); // remove div23});2425test("string对象", function(){26 equals(baidu.lang.isObject(new String("test")), true, 'baidu.lang.isObject(new String("test")) is true');27});2829test("string类型", function(){30 equals(baidu.lang.isObject("test"), false, 'baidu.lang.isObject("test") is false');31});3233test("number类型", function(){34 equals(baidu.lang.isObject(1), false, 'baidu.lang.isObject(1) is false');35});3637test("boolean类型", function(){38 equals(baidu.lang.isObject(true), false, 'baidu.lang.isObject(true) is false');39 equals(baidu.lang.isObject(false), false, 'baidu.lang.isObject(false) is false');40});4142test("null参数", function(){43 equals(baidu.lang.isObject(null), false, 'baidu.lang.isObject(null) is false');44});4546test("undefined参数", function(){47 equals(baidu.lang.isObject(void(1)), false, 'baidu.lang.isObject(void(1)) is false');48});4950test("快捷方式", function(){51 equals(baidu.isObject({}), true, 'baidu.isObject({}) is true');52});53545556//describe('baidu.lang.isObject测试',{57// 'Object参数': function () {58// value_of(baidu.lang.isObject({})).should_be_true();59// },60//61// 'Function类型': function () {62// value_of(baidu.lang.isObject(new Function())).should_be_true();63// },64//65// 'Array对象': function () {66// value_of(baidu.lang.isObject([])).should_be_true();67// },68//69// 'Element对象': function () {70// value_of(baidu.lang.isObject(document.getElementById('erikElement'))).should_be_true();71// },72// 73// 'string对象': function () {74// value_of(baidu.lang.isObject(new String("string object"))).should_be_true();75// },76// 77// 'string类型': function () {78// value_of(baidu.lang.isObject("test")).should_be_false();79// },80//81// 'number类型': function () {82// value_of(baidu.lang.isObject(1)).should_be_false();83// },84//85// 'boolean类型': function () {86// value_of(baidu.lang.isObject(true)).should_be_false();87// },88//89// 'null参数': function () {90// value_of(baidu.lang.isObject(null)).should_be_false();91// },92//93// 'undefined参数': function () {94// value_of(baidu.lang.isObject(void(0))).should_be_false();95// },96// 97// '快捷方式': function () {98// value_of(baidu.isObject({})).should_be_true();99// } ...

Full Screen

Full Screen

isObject.test.js

Source:isObject.test.js Github

copy

Full Screen

...3import { args, slice, document, body, symbol, falsey, stubFalse, realm } from './utils.js';4import isObject from '../isObject.js';5describe('isObject', function() {6 it('should return `true` for objects', function() {7 assert.strictEqual(isObject(args), true);8 assert.strictEqual(isObject([1, 2, 3]), true);9 assert.strictEqual(isObject(Object(false)), true);10 assert.strictEqual(isObject(new Date), true);11 assert.strictEqual(isObject(new Error), true);12 assert.strictEqual(isObject(_), true);13 assert.strictEqual(isObject(slice), true);14 assert.strictEqual(isObject({ 'a': 1 }), true);15 assert.strictEqual(isObject(Object(0)), true);16 assert.strictEqual(isObject(/x/), true);17 assert.strictEqual(isObject(Object('a')), true);18 if (document) {19 assert.strictEqual(isObject(body), true);20 }21 if (Symbol) {22 assert.strictEqual(isObject(Object(symbol)), true);23 }24 });25 it('should return `false` for non-objects', function() {26 var values = falsey.concat(true, 1, 'a', symbol),27 expected = lodashStable.map(values, stubFalse);28 var actual = lodashStable.map(values, function(value, index) {29 return index ? isObject(value) : isObject();30 });31 assert.deepStrictEqual(actual, expected);32 });33 it('should work with objects from another realm', function() {34 if (realm.element) {35 assert.strictEqual(isObject(realm.element), true);36 }37 if (realm.object) {38 assert.strictEqual(isObject(realm.boolean), true);39 assert.strictEqual(isObject(realm.date), true);40 assert.strictEqual(isObject(realm.function), true);41 assert.strictEqual(isObject(realm.number), true);42 assert.strictEqual(isObject(realm.object), true);43 assert.strictEqual(isObject(realm.regexp), true);44 assert.strictEqual(isObject(realm.string), true);45 }46 });...

Full Screen

Full Screen

is.js

Source:is.js Github

copy

Full Screen

1"use strict";2var assert = require("chai").assert3 , isObject = require("../../object/is");4describe("object/is", function () {5 it("Should return true on object", function () { assert.equal(isObject({}), true); });6 it("Should return true on function", function () {7 assert.equal(isObject(function () { return true; }), true);8 });9 it("Should return true on array", function () { assert.equal(isObject([]), true); });10 if (typeof Object.create === "function") {11 it("Should return true on object with no prototype", function () {12 assert.equal(isObject(Object.create(null)), true);13 });14 }15 it("Should return false on string", function () { assert.equal(isObject("foo"), false); });16 it("Should return false on empty string", function () { assert.equal(isObject(""), false); });17 it("Should return false on number", function () { assert.equal(isObject(123), false); });18 it("Should return false on NaN", function () { assert.equal(isObject(NaN), false); });19 it("Should return false on boolean", function () { assert.equal(isObject(true), false); });20 if (typeof Symbol === "function") {21 it("Should return false on symbol", function () {22 assert.equal(isObject(Symbol("foo")), false);23 });24 }25 it("Should return false on null", function () { assert.equal(isObject(null), false); });26 it("Should return false on undefined", function () { assert.equal(isObject(void 0), false); });...

Full Screen

Full Screen

index.spec.js

Source:index.spec.js Github

copy

Full Screen

1import isObject from './index';2describe('isObject::', () => {3 /** @test {isObject} */4 it('Should return true for object literal {}', () => {5 expect(isObject({})).toEqual(true);6 });7 /** @test {isObject} */8 it('Should return false for array literal []', () => {9 expect(isObject([])).toEqual(false);10 });11 /** @test {isObject} */12 it('Should return false for null', () => {13 expect(isObject(null)).toEqual(false);14 });15 /** @test {isObject} */16 it('Should return false for primitive values', () => {17 expect(isObject(1)).toEqual(false);18 expect(isObject('string')).toEqual(false);19 expect(isObject(true)).toEqual(false);20 });...

Full Screen

Full Screen

Using AI Code Generation

copy

Full Screen

1import { isObject } from 'storybook-root';2import { isObject } from 'storybook-root';3import { isObject } from 'storybook-root';4import { isObject } from 'storybook-root';5import { isObject } from 'storybook-root';6import { isObject } from 'storybook-root';7import { isObject } from 'storybook-root';8import { isObject } from 'storybook-root';9import { isObject } from 'storybook-root';10import { isObject } from 'storybook-root';11import { isObject } from 'storybook-root';12import { isObject } from 'storybook-root';13import { isObject } from 'storybook-root';14import { isObject } from 'storybook-root';15import { isObject } from 'storybook-root';16import { isObject } from 'storybook-root';17import { isObject } from 'storybook-root';18import { isObject } from 'storybook-root';19import { isObject } from 'storybook-root';20import { isObject } from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1import {isObject} from 'storybook-root';2import {isObject} from 'storybook-root';3import {isObject} from 'storybook-root';4import {isObject} from 'storybook-root';5import {isObject} from 'storybook-root';6import {isObject} from 'storybook-root';7import {isObject} from 'storybook-root';8import {isObject} from 'storybook-root';9import {isObject} from 'storybook-root';10import {isObject} from 'storybook-root';11import {isObject} from 'storybook-root';12import {isObject} from 'storybook-root';13import {isObject} from 'storybook-root';14import {isObject} from 'storybook-root';15import {isObject} from 'storybook-root';16import {isObject} from 'storybook-root';17import {isObject} from 'storybook-root';18import {isObject} from 'storybook-root';19import {isObject} from 'storybook-root';20import {isObject} from 'storybook-root';21import {isObject} from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1import {isObject} from 'storybook-root';2import {isObject} from 'storybook-root';3import {isObject} from 'storybook-root';4import {isObject} from 'storybook-root';5import {isObject} from 'storybook-root';6import {isObject} from 'storybook-root';7import {isObject} from 'storybook-root';8import {isObject} from 'storybook-root';9import {isObject} from 'storybook-root';10import {isObject} from 'storybook-root';

Full Screen

Using AI Code Generation

copy

Full Screen

1const root = require('storybook-root');2const {isObject} = root.utils;3const {isObject} = require('storybook-root/utils');4const {utils} = require('storybook-root');5const {isObject} = utils;6const {utils: {isObject}} = require('storybook-root');7const {utils: {isObject: checkObject}} = require('storybook-root');8const {utils: {isObject: checkObject}} = require('storybook-root');9const {utils: {isObject: checkObject}} = require('storybook-root');10const {utils: {isObject: checkObject}} = require('storybook-root');11const {utils: {isObject: checkObject}}

Full Screen

Using AI Code Generation

copy

Full Screen

1const storybookRoot = require('storybook-root');2const isObject = storybookRoot.isObject;3const sampleObject = {4 address: {5 }6};7console.log(isObject(new Date()));

Full Screen

Using AI Code Generation

copy

Full Screen

1import isObject from 'storybook-root/isObject'2const test = isObject('test')3console.log(test)4 @ multi ./src/test.js ./node_modules/@storybook/addon-storysource/loader.js?{"parser":"javascript","prettierConfig":{"printWidth":80,"singleQuote":false,"trailingComma":"es5"},"injectStoryParameters":true} ./node_modules/@storybook/addon-actions/register.js ./node_modules/@storybook/addon-links/register.js ./node_modules/@storybook/addon-knobs/register.js ./node_modules/@storybook/addon-notes/register.js ./node_modules/@storybook/addon-options/register.js ./node_modules/@storybook/addon-backgrounds/register.js ./node_modules/@storybook/addon-viewport/register.js ./node_modules/@storybook/addon-a11y/register.js ./node_modules/@storybook/addon-contexts/register.js ./node_modules/@storybook/addon-storyshots/register.js ./node_modules/@storybook/addon-jest/register.js5I have tried the following ways of importing6import isObject from 'storybook-root/isObject'7import isObject from 'storybook-root/lib/isObject'8import isObject from 'storybook-root/src/isObject'9import isObject from '/Users/username/project/node_modules/storybook-root/src/isObject'10import React from 'react';11import PropTypes from 'prop-types';12const propTypes = {13 children: PropTypes.oneOfType([14 PropTypes.arrayOf(PropTypes.element),15};16const defaultProps = {17};18const MyComponent = ({ children }) => (19 {children}20);21MyComponent.propTypes = propTypes;22MyComponent.defaultProps = defaultProps;23export default MyComponent;

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 storybook-root 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