Skip to content

Commit c9600ee

Browse files
committed
finsihed enzyme unit tests, working on supertest for server
1 parent 243cda1 commit c9600ee

File tree

2 files changed

+368
-1
lines changed

2 files changed

+368
-1
lines changed

__tests__/__snapshots__/enzyme.test.tsx.snap

Lines changed: 359 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -359,6 +359,365 @@ exports[`Test All 10 default HTML elements have rendered Matches snapshot 1`] =
359359
</ContextProvider>
360360
`;
361361

362+
exports[`Test HTMLPanel Component Matches snapshot 1`] = `
363+
<ContextProvider
364+
value={
365+
Object {
366+
"dragDropManager": DragDropManagerImpl {
367+
"backend": HTML5BackendImpl {
368+
"actions": Object {
369+
"beginDrag": [Function],
370+
"drop": [Function],
371+
"endDrag": [Function],
372+
"hover": [Function],
373+
"publishDragSource": [Function],
374+
},
375+
"altKeyPressed": false,
376+
"asyncEndDragFrameId": null,
377+
"currentDragSourceNode": null,
378+
"currentNativeHandle": null,
379+
"currentNativeSource": null,
380+
"dragEnterTargetIds": Array [],
381+
"dragOverTargetIds": null,
382+
"dragStartSourceIds": null,
383+
"dropTargetIds": Array [],
384+
"endDragIfSourceWasRemovedFromDOM": [Function],
385+
"endDragNativeItem": [Function],
386+
"enterLeaveCounter": EnterLeaveCounter {
387+
"entered": Array [],
388+
"isNodeInDocument": [Function],
389+
},
390+
"getSourceClientOffset": [Function],
391+
"handleSelectStart": [Function],
392+
"handleTopDragEndCapture": [Function],
393+
"handleTopDragEnter": [Function],
394+
"handleTopDragEnterCapture": [Function],
395+
"handleTopDragLeaveCapture": [Function],
396+
"handleTopDragOver": [Function],
397+
"handleTopDragOverCapture": [Function],
398+
"handleTopDragStart": [Function],
399+
"handleTopDragStartCapture": [Function],
400+
"handleTopDrop": [Function],
401+
"handleTopDropCapture": [Function],
402+
"isNodeInDocument": [Function],
403+
"monitor": DragDropMonitorImpl {
404+
"registry": HandlerRegistryImpl {
405+
"dragSources": Map {},
406+
"dropTargets": Map {},
407+
"pinnedSource": null,
408+
"pinnedSourceId": null,
409+
"store": Object {
410+
"dispatch": [Function],
411+
"getState": [Function],
412+
"replaceReducer": [Function],
413+
"subscribe": [Function],
414+
Symbol(observable): [Function],
415+
},
416+
"types": Map {},
417+
},
418+
"store": Object {
419+
"dispatch": [Function],
420+
"getState": [Function],
421+
"replaceReducer": [Function],
422+
"subscribe": [Function],
423+
Symbol(observable): [Function],
424+
},
425+
},
426+
"mouseMoveTimeoutTimer": null,
427+
"options": OptionsReader {
428+
"globalContext": [Window],
429+
},
430+
"registry": HandlerRegistryImpl {
431+
"dragSources": Map {},
432+
"dropTargets": Map {},
433+
"pinnedSource": null,
434+
"pinnedSourceId": null,
435+
"store": Object {
436+
"dispatch": [Function],
437+
"getState": [Function],
438+
"replaceReducer": [Function],
439+
"subscribe": [Function],
440+
Symbol(observable): [Function],
441+
},
442+
"types": Map {},
443+
},
444+
"sourceNodeOptions": Map {},
445+
"sourceNodes": Map {},
446+
"sourcePreviewNodeOptions": Map {},
447+
"sourcePreviewNodes": Map {},
448+
},
449+
"handleRefCountChange": [Function],
450+
"isSetUp": false,
451+
"monitor": DragDropMonitorImpl {
452+
"registry": HandlerRegistryImpl {
453+
"dragSources": Map {},
454+
"dropTargets": Map {},
455+
"pinnedSource": null,
456+
"pinnedSourceId": null,
457+
"store": Object {
458+
"dispatch": [Function],
459+
"getState": [Function],
460+
"replaceReducer": [Function],
461+
"subscribe": [Function],
462+
Symbol(observable): [Function],
463+
},
464+
"types": Map {},
465+
},
466+
"store": Object {
467+
"dispatch": [Function],
468+
"getState": [Function],
469+
"replaceReducer": [Function],
470+
"subscribe": [Function],
471+
Symbol(observable): [Function],
472+
},
473+
},
474+
"store": Object {
475+
"dispatch": [Function],
476+
"getState": [Function],
477+
"replaceReducer": [Function],
478+
"subscribe": [Function],
479+
Symbol(observable): [Function],
480+
},
481+
},
482+
}
483+
}
484+
>
485+
<ContextProvider
486+
value={
487+
Object {
488+
"HTMLTypes": Array [
489+
Object {
490+
"icon": Object {
491+
"$$typeof": Symbol(react.memo),
492+
"compare": null,
493+
"type": Object {
494+
"$$typeof": Symbol(react.forward_ref),
495+
"render": [Function],
496+
},
497+
},
498+
"id": 11,
499+
"name": "Div",
500+
"placeHolderLong": "",
501+
"placeHolderShort": "div",
502+
"style": Object {},
503+
"tag": "div",
504+
},
505+
Object {
506+
"icon": "",
507+
"id": 1000,
508+
"name": "separator",
509+
"placeHolderLong": "",
510+
"placeHolderShort": "",
511+
"style": Object {
512+
"border": "none",
513+
},
514+
"tag": "separator",
515+
},
516+
Object {
517+
"icon": Object {
518+
"$$typeof": Symbol(react.memo),
519+
"compare": null,
520+
"type": Object {
521+
"$$typeof": Symbol(react.forward_ref),
522+
"render": [Function],
523+
},
524+
},
525+
"id": 1,
526+
"name": "Image",
527+
"placeHolderLong": "",
528+
"placeHolderShort": "Image",
529+
"style": Object {},
530+
"tag": "img",
531+
},
532+
Object {
533+
"icon": Object {
534+
"$$typeof": Symbol(react.memo),
535+
"compare": null,
536+
"type": Object {
537+
"$$typeof": Symbol(react.forward_ref),
538+
"render": [Function],
539+
},
540+
},
541+
"id": 2,
542+
"name": "Form",
543+
"placeHolderLong": "",
544+
"placeHolderShort": "Form",
545+
"style": Object {},
546+
"tag": "form",
547+
},
548+
Object {
549+
"icon": Object {
550+
"$$typeof": Symbol(react.memo),
551+
"compare": null,
552+
"type": Object {
553+
"$$typeof": Symbol(react.forward_ref),
554+
"render": [Function],
555+
},
556+
},
557+
"id": 3,
558+
"name": "List",
559+
"placeHolderLong": "",
560+
"placeHolderShort": <ul>
561+
<li>
562+
item 1
563+
</li>
564+
<li>
565+
item 2
566+
</li>
567+
<li>
568+
item 3
569+
</li>
570+
</ul>,
571+
"style": Object {
572+
"color": "purple",
573+
},
574+
"tag": "li",
575+
},
576+
Object {
577+
"icon": Object {
578+
"$$typeof": Symbol(react.memo),
579+
"compare": null,
580+
"type": Object {
581+
"$$typeof": Symbol(react.forward_ref),
582+
"render": [Function],
583+
},
584+
},
585+
"id": 4,
586+
"name": "Button",
587+
"placeHolderLong": "",
588+
"placeHolderShort": <button>
589+
Button
590+
</button>,
591+
"style": Object {
592+
"border": "none",
593+
"textAlign": "center",
594+
},
595+
"tag": "button",
596+
},
597+
Object {
598+
"icon": Object {
599+
"$$typeof": Symbol(react.memo),
600+
"compare": null,
601+
"type": Object {
602+
"$$typeof": Symbol(react.forward_ref),
603+
"render": [Function],
604+
},
605+
},
606+
"id": 6,
607+
"name": "Link",
608+
"placeHolderLong": "",
609+
"placeHolderShort": <a
610+
href="#"
611+
>
612+
Link
613+
</a>,
614+
"style": Object {
615+
"border": "none",
616+
},
617+
"tag": "a",
618+
},
619+
Object {
620+
"icon": Object {
621+
"$$typeof": Symbol(react.memo),
622+
"compare": null,
623+
"type": Object {
624+
"$$typeof": Symbol(react.forward_ref),
625+
"render": [Function],
626+
},
627+
},
628+
"id": 8,
629+
"name": "Paragraph",
630+
"placeHolderLong": "",
631+
"placeHolderShort": "Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatu",
632+
"style": Object {},
633+
"tag": "p",
634+
},
635+
Object {
636+
"icon": Object {
637+
"$$typeof": Symbol(react.memo),
638+
"compare": null,
639+
"type": Object {
640+
"$$typeof": Symbol(react.forward_ref),
641+
"render": [Function],
642+
},
643+
},
644+
"id": 9,
645+
"name": "Header 1",
646+
"placeHolderLong": "",
647+
"placeHolderShort": "Header 1",
648+
"style": Object {
649+
"fontSize": "2em",
650+
},
651+
"tag": "h1",
652+
},
653+
Object {
654+
"icon": Object {
655+
"$$typeof": Symbol(react.memo),
656+
"compare": null,
657+
"type": Object {
658+
"$$typeof": Symbol(react.forward_ref),
659+
"render": [Function],
660+
},
661+
},
662+
"id": 10,
663+
"name": "Header 2",
664+
"placeHolderLong": "",
665+
"placeHolderShort": "Header 2",
666+
"style": Object {
667+
"fontSize": "1.5em",
668+
},
669+
"tag": "h2",
670+
},
671+
Object {
672+
"icon": Object {
673+
"$$typeof": Symbol(react.memo),
674+
"compare": null,
675+
"type": Object {
676+
"$$typeof": Symbol(react.forward_ref),
677+
"render": [Function],
678+
},
679+
},
680+
"id": 5,
681+
"name": "Span",
682+
"placeHolderLong": "",
683+
"placeHolderShort": "Span",
684+
"style": Object {
685+
"fontSize": "1.5em",
686+
},
687+
"tag": "span",
688+
},
689+
],
690+
"canvasFocus": Object {
691+
"childId": null,
692+
"componentId": 1,
693+
},
694+
"components": Array [
695+
Object {
696+
"children": Array [],
697+
"code": "<div>Drag in a component or HTML element into the canvas!</div>",
698+
"id": 1,
699+
"isPage": true,
700+
"name": "index",
701+
"style": Object {},
702+
},
703+
],
704+
"isLoggedIn": false,
705+
"name": "",
706+
"nextChildId": 1,
707+
"nextComponentId": 2,
708+
"nextTopSeparatorId": 1000,
709+
"projectType": "Classic React",
710+
"rootComponents": Array [
711+
1,
712+
],
713+
}
714+
}
715+
>
716+
<HTMLPanel />
717+
</ContextProvider>
718+
</ContextProvider>
719+
`;
720+
362721
exports[`Test the BottomTabs component Matches snapshot 1`] = `
363722
<div
364723
className="makeStyles-root-1"

__tests__/enzyme.test.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ import AppContainer from '../app/src/containers/AppContainer';
1717
import NavBar from '../app/src/components/top/NavBar';
1818
import MenuItem from '@material-ui/core/MenuItem';
1919
import Tab from '@material-ui/core/Tab';
20+
import RightContainer from '../app/src/containers/RightContainer';
21+
import ProjectManager from '../app/src/components/right/ProjectManager';
2022
// npm test -- -u
2123

2224
describe('Test the CanvasContainer component', () => {
@@ -99,7 +101,13 @@ describe('Test AppContainer container', () => {
99101
)
100102
).toBeDefined();
101103
});
102-
104+
// testing for a RightContainer
105+
it('Should render RightContainer', () => {
106+
expect(
107+
target.contains(
108+
<RightContainer />,
109+
),
110+
).toBe(true);
103111
});
104112

105113
// testing for NavBar component

0 commit comments

Comments
 (0)