@licklist/design 0.58.6-dev.9 → 0.58.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bitbucket-pipelines.yml +8 -0
- package/dist/assets/iframe/calendar.svg +2 -2
- package/dist/assets/iframe/calendar.svg.js +1 -1
- package/dist/assets/iframe/ticket.svg +2 -2
- package/dist/assets/iframe/ticket.svg.js +1 -1
- package/dist/calendar/Calendar.d.ts +1 -1
- package/dist/calendar/Calendar.d.ts.map +1 -1
- package/dist/calendar/Calendar.js +1 -1
- package/dist/calendar/components/CalendarButtons/CalendarButtons.js +1 -1
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts +2 -2
- package/dist/calendar/components/CalendarDates/CalendarDates.d.ts.map +1 -1
- package/dist/calendar/components/CalendarDates/CalendarDates.js +1 -1
- package/dist/events/edit-event-modal/component/EditEventForm/EditEventForm.js +1 -1
- package/dist/events/event-statistic-modal/EventStatisticModal.js +1 -1
- package/dist/iframe/event/event-card/IframeEventCard.d.ts +1 -2
- package/dist/iframe/event/event-card/IframeEventCard.d.ts.map +1 -1
- package/dist/iframe/event/event-card/IframeEventCard.js +1 -1
- package/dist/iframe/event/event-venue-map/IframeEventVenueMap.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts +2 -2
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/BookingSummary.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts +2 -4
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.d.ts +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.d.ts +2 -4
- package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.d.ts.map +1 -1
- package/dist/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.js +1 -1
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts +0 -4
- package/dist/iframe/order-process/components/BookingSummary/types/index.d.ts.map +1 -1
- package/dist/iframe/order-process/components/CalendarStepsForm/CalendarStepsForm.js +1 -1
- package/dist/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.js +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.js +1 -1
- package/dist/iframe/page/components/PageBody/constants.d.ts +0 -1
- package/dist/iframe/page/components/PageBody/constants.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/constants.js +1 -1
- package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.d.ts.map +1 -1
- package/dist/iframe/page/components/PageBody/hooks/useResizePageBody.js +1 -1
- package/dist/iframe/payment/order-items-table/OrderItemsTable.js +1 -1
- package/dist/iframe/payment/order-items-table/utils/paymentSummary.js +1 -1
- package/dist/iframe/payment/payment-form/PaymentForm.js +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.d.ts.map +1 -1
- package/dist/iframe/payment/payment-page/PaymentPage.js +1 -1
- package/dist/iframe/payment/payment-page/PaymentTimer.js +1 -1
- package/dist/iframe/payment/payment-status-page/PaymentStatusPage.js +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.d.ts.map +1 -1
- package/dist/iframe/ryft/RyftPaymentForm.js +1 -1
- package/dist/index.js +1 -1
- package/dist/product-set/card/ProductSetCard.d.ts +1 -2
- package/dist/product-set/card/ProductSetCard.d.ts.map +1 -1
- package/dist/product-set/card/ProductSetCard.js +1 -1
- package/dist/product-set/control/ProductSetControl.d.ts +1 -2
- package/dist/product-set/control/ProductSetControl.d.ts.map +1 -1
- package/dist/product-set/control/ProductSetControl.js +1 -1
- package/dist/product-set/control/TutorialGifCard.d.ts +1 -2
- package/dist/product-set/control/TutorialGifCard.d.ts.map +1 -1
- package/dist/product-set/control/TutorialGifCard.js +1 -1
- package/dist/product-set/form/ProductCategoriesControl.d.ts +1 -2
- package/dist/product-set/form/ProductCategoriesControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductCategoriesControl.js +1 -1
- package/dist/product-set/form/ProductSetForm.d.ts +2 -7
- package/dist/product-set/form/ProductSetForm.d.ts.map +1 -1
- package/dist/product-set/form/ProductSetForm.js +1 -1
- package/dist/product-set/form/ProductsControl.d.ts +1 -2
- package/dist/product-set/form/ProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/ProductsControl.js +1 -1
- package/dist/product-set/form/StepsControl.d.ts +1 -2
- package/dist/product-set/form/StepsControl.d.ts.map +1 -1
- package/dist/product-set/form/StepsControl.js +1 -1
- package/dist/product-set/form/SubProductsControl.d.ts +1 -2
- package/dist/product-set/form/SubProductsControl.d.ts.map +1 -1
- package/dist/product-set/form/SubProductsControl.js +1 -1
- package/dist/product-set/form/VenueMapsControl.js +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts +1 -2
- package/dist/product-set/hooks/useSortableTreeFunctions.d.ts.map +1 -1
- package/dist/product-set/hooks/useSortableTreeFunctions.js +1 -1
- package/dist/product-set/item/CreateProductSetItem.d.ts +1 -2
- package/dist/product-set/item/CreateProductSetItem.d.ts.map +1 -1
- package/dist/product-set/item/CreateProductSetItem.js +1 -1
- package/dist/product-set/product/ProductControl.d.ts +1 -3
- package/dist/product-set/product/ProductControl.d.ts.map +1 -1
- package/dist/product-set/product/ProductControl.js +1 -1
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts +2 -4
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.d.ts.map +1 -1
- package/dist/product-set/product/fixed-duration-fields/FixedDurationOptions.js +1 -1
- package/dist/product-set/product/quantity/ProductQuantityControl.d.ts +0 -1
- package/dist/product-set/product/quantity/ProductQuantityControl.d.ts.map +1 -1
- package/dist/product-set/product/quantity/ProductQuantityControl.js +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.d.ts +1 -3
- package/dist/product-set/product-category/ProductCategoryControl.d.ts.map +1 -1
- package/dist/product-set/product-category/ProductCategoryControl.js +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.d.ts.map +1 -1
- package/dist/provider/working-hours-input/WorkingHoursInputDescription.js +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts +0 -2
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.d.ts.map +1 -1
- package/dist/recurring-date-picker-input/RecurringDatePickerInput.js +1 -1
- package/dist/sales/booking/results/components/ResultCard.d.ts.map +1 -1
- package/dist/sales/booking/results/components/ResultCard.js +1 -1
- package/dist/sales/notes/NotesTableRow.js +1 -1
- package/dist/setting/dashboard/snippets/card/SnippetCard.js +1 -1
- package/dist/snippet/snippet-template/control/PropertyControl.d.ts +1 -3
- package/dist/snippet/snippet-template/control/PropertyControl.d.ts.map +1 -1
- package/dist/snippet/snippet-template/control/PropertyControl.js +1 -1
- package/dist/snippet/snippet-template/preview/Preview.js +1 -1
- package/dist/sortable-list/SortableList.d.ts +1 -2
- package/dist/sortable-list/SortableList.d.ts.map +1 -1
- package/dist/sortable-list/SortableList.js +1 -1
- package/dist/sortable-tree/SortableTreeItem.d.ts +1 -3
- package/dist/sortable-tree/SortableTreeItem.d.ts.map +1 -1
- package/dist/sortable-tree/SortableTreeItem.js +1 -1
- package/dist/static/manual-date-picker/ManualDatePicker.js +1 -1
- package/dist/static/manual-date-picker/constants/index.d.ts +1 -4
- package/dist/static/manual-date-picker/constants/index.d.ts.map +1 -1
- package/dist/static/manual-date-picker/constants/index.js +1 -1
- package/dist/static/manual-date-picker/utils/index.d.ts +0 -4
- package/dist/static/manual-date-picker/utils/index.d.ts.map +1 -1
- package/dist/static/manual-date-picker/utils/index.js +1 -1
- package/dist/striped-static-table/StripedStaticTable.js +1 -1
- package/dist/styles/iframe-events/Card.scss +8 -24
- package/dist/styles/iframe-events/PoweredBy.scss +2 -2
- package/dist/styles/iframe-order-process/IframeOrderProcess.scss +20 -57
- package/dist/styles/iframe-page/Page.scss +0 -1
- package/dist/styles/iframe-page/PageBody.scss +12 -34
- package/dist/styles/iframe-page/PageHeader.scss +39 -41
- package/dist/styles/product-set/EditVenueMapSetModal.scss +1 -1
- package/dist/styles/ryft-payment-form/RyftPaymentForm.scss +2 -125
- package/dist/styles/sales/BookingResults.scss +1 -1
- package/dist/venue-map-sets/form/components/VenueMapImageControl.js +1 -1
- package/jest.config.js +29 -0
- package/package.json +35 -10
- package/src/assets/iframe/calendar.svg +2 -2
- package/src/assets/iframe/ticket.svg +2 -2
- package/src/calendar/Calendar.stories.tsx +0 -23
- package/src/calendar/Calendar.tsx +5 -5
- package/src/calendar/components/CalendarDates/CalendarDates.tsx +5 -0
- package/src/iframe/event/event-card/IframeEventCard.stories.tsx +0 -1
- package/src/iframe/event/event-card/IframeEventCard.tsx +8 -7
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.stories.tsx +0 -9
- package/src/iframe/order-process/components/BookingSummary/BookingSummary.tsx +7 -58
- package/src/iframe/order-process/components/BookingSummary/components/BookingSummaryAccordion/BookingSummaryAccordion.tsx +0 -8
- package/src/iframe/order-process/components/BookingSummary/components/SummaryTotal/components/SummaryTotalBlock.tsx +4 -4
- package/src/iframe/order-process/components/BookingSummary/components/ToggleHeader/ToggleHeader.tsx +10 -63
- package/src/iframe/order-process/components/BookingSummary/types/index.ts +0 -4
- package/src/iframe/order-process/components/CategoryProduct/components/NumberInput/NumberInput.tsx +1 -1
- package/src/iframe/page/components/PageBody/components/LeftBlock/LeftBlock.tsx +1 -3
- package/src/iframe/page/components/PageBody/constants.ts +0 -2
- package/src/iframe/page/components/PageBody/hooks/useResizePageBody.ts +0 -10
- package/src/iframe/payment/order-items-table/utils/paymentSummary.tsx +6 -6
- package/src/iframe/payment/payment-page/PaymentPage.stories.tsx +6 -546
- package/src/iframe/payment/payment-page/PaymentPage.tsx +29 -38
- package/src/iframe/ryft/RyftPaymentForm.tsx +5 -11
- package/src/product-set/card/ProductSetCard.tsx +1 -12
- package/src/product-set/control/ProductSetControl.tsx +24 -46
- package/src/product-set/control/TutorialGifCard.tsx +3 -11
- package/src/product-set/form/ProductCategoriesControl.tsx +1 -12
- package/src/product-set/form/ProductSetForm.tsx +1 -10
- package/src/product-set/form/ProductsControl.tsx +0 -10
- package/src/product-set/form/StepsControl.tsx +2 -8
- package/src/product-set/form/SubProductsControl.tsx +0 -3
- package/src/product-set/hooks/useSortableTreeFunctions.ts +0 -6
- package/src/product-set/item/CreateProductSetItem.tsx +0 -3
- package/src/product-set/product/ProductControl.tsx +15 -48
- package/src/product-set/product/fixed-duration-fields/FixedDurationOptions.tsx +2 -8
- package/src/product-set/product/quantity/ProductQuantityControl.tsx +3 -4
- package/src/product-set/product-category/ProductCategoryControl.tsx +50 -116
- package/src/provider/working-hours-input/WorkingHoursInputDescription.tsx +18 -4
- package/src/recurring-date-picker-input/RecurringDatePickerInput.tsx +1 -4
- package/src/sales/booking/results/BookingResults.stories.tsx +2 -3
- package/src/sales/booking/results/components/ResultCard.tsx +5 -2
- package/src/snippet/snippet-template/control/PropertyControl.tsx +2 -6
- package/src/sortable-list/SortableList.tsx +0 -3
- package/src/sortable-tree/SortableTreeItem.tsx +0 -6
- package/src/static/manual-date-picker/ManualDatePicker.tsx +3 -3
- package/src/static/manual-date-picker/constants/index.ts +2 -6
- package/src/static/manual-date-picker/utils/index.ts +0 -11
- package/src/static/switch/BooleanSwitch.tsx +1 -1
- package/src/styles/iframe-events/Card.scss +8 -24
- package/src/styles/iframe-events/PoweredBy.scss +2 -2
- package/src/styles/iframe-order-process/IframeOrderProcess.scss +20 -57
- package/src/styles/iframe-page/Page.scss +0 -1
- package/src/styles/iframe-page/PageBody.scss +12 -34
- package/src/styles/iframe-page/PageHeader.scss +39 -41
- package/src/styles/product-set/EditVenueMapSetModal.scss +1 -1
- package/src/styles/ryft-payment-form/RyftPaymentForm.scss +2 -125
- package/src/styles/sales/BookingResults.scss +1 -1
- package/tests/Auth/Authorizer.test.tsx +194 -0
- package/tests/Auth/Layout/UserNavDropDown.test.tsx +43 -0
- package/tests/Auth/Layout/UserNavDropDownToggle.test.tsx +33 -0
- package/tests/Auth/Login/LoginComponent.test.tsx +246 -0
- package/tests/Auth/Login/LoginFormComponent.test.tsx +182 -0
- package/tests/Auth/Register/RegisterComponent.test.tsx +285 -0
- package/tests/Auth/Register/RegisterFormComponent.test.tsx +170 -0
- package/tests/Auth/Settings/Dashboard/IpInput.test.tsx +130 -0
- package/tests/Auth/Social/SocialCallbackComponent.test.tsx +133 -0
- package/tests/Auth/Social/SocialFormComponent.test.tsx +118 -0
- package/tests/FileUpload/FileUpload.test.tsx +42 -0
- package/tests/Notification/EmailTemplate.test.tsx +82 -0
- package/tests/ProductSet/ProductSetPopover.test.tsx +40 -0
- package/tests/Report/Report.test.tsx +48 -0
- package/tests/Sales/Coupon.test.tsx +51 -0
- package/tests/Sales/SalesAndVIews.test.tsx +63 -0
- package/tests/SnippetTemplates/SnippetTemplates.test.tsx +56 -0
- package/tests/Table/FilterHelperComponent.test.tsx +88 -0
- package/tests/Table/PaginationHelperComponent.test.tsx +109 -0
- package/tests/Table/PerPageHelperComponent.test.tsx +34 -0
- package/tests/Table/TableHelperComponent.test.tsx +295 -0
- package/tests/TipTapEditor/TipTapEditor.test.tsx +28 -0
- package/tests/__mock__/hooks/useAuthApi.ts +13 -0
- package/tests/__mock__/hooks/useAuthMock.ts +13 -0
- package/tests/__mock__/hooks/useFormMock.ts +27 -0
- package/tests/__mock__/hooks/useNotificationMock.ts +13 -0
- package/tests/__mock__/hooks/useQueryMock.ts +16 -0
- package/tests/__mock__/hooks/useSocialApiMock.ts +20 -0
- package/tests/__mock__/hooks/useTranslationMock.ts +17 -0
- package/tests/__mock__/hooks/useUserApiMock.ts +18 -0
- package/tests/__mock__/hooks/useUserMock.ts +13 -0
- package/tests/__mock__/styleMock.js +1 -0
- package/tests/__mock__/windowMock.ts +5 -0
- package/tests/packages/react-query.tsx +28 -0
- package/tests/setupTests.ts +10 -0
- package/dist/iframe/ryft/utils/ryft-form.d.ts +0 -5
- package/dist/iframe/ryft/utils/ryft-form.d.ts.map +0 -1
- package/dist/iframe/ryft/utils/ryft-form.js +0 -1
- package/dist/product-set/control/DateInput.d.ts +0 -17
- package/dist/product-set/control/DateInput.d.ts.map +0 -1
- package/dist/product-set/control/DateInput.js +0 -1
- package/dist/product-set/control/ProductSetRecurrenceOverridesControl.d.ts +0 -11
- package/dist/product-set/control/ProductSetRecurrenceOverridesControl.d.ts.map +0 -1
- package/dist/product-set/control/ProductSetRecurrenceOverridesControl.js +0 -1
- package/dist/recurring-date-picker-input/DatePickerInput.d.ts +0 -19
- package/dist/recurring-date-picker-input/DatePickerInput.d.ts.map +0 -1
- package/dist/recurring-date-picker-input/DatePickerInput.js +0 -1
- package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts +0 -15
- package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.d.ts.map +0 -1
- package/dist/recurring-date-picker-input/RecurrenceAndFrequencyInput.js +0 -1
- package/src/iframe/ryft/utils/ryft-form.ts +0 -47
- package/src/product-set/control/DateInput.tsx +0 -313
- package/src/product-set/control/ProductSetRecurrenceOverridesControl.tsx +0 -63
- package/src/recurring-date-picker-input/DatePickerInput.tsx +0 -93
- package/src/recurring-date-picker-input/RecurrenceAndFrequencyInput.tsx +0 -136
|
@@ -1,52 +1,10 @@
|
|
|
1
1
|
.payment_link {
|
|
2
|
-
padding: 0 0 1rem 0;
|
|
3
|
-
|
|
4
|
-
.button-wrapper {
|
|
5
|
-
top: 2rem;
|
|
6
|
-
right: 2rem;
|
|
7
|
-
position: absolute;
|
|
8
|
-
z-index: 100;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
2
|
.page-body {
|
|
12
|
-
padding: 0;
|
|
13
|
-
height: calc(100vh - 2rem) !important;
|
|
14
|
-
|
|
15
|
-
.navigation {
|
|
16
|
-
display: block;
|
|
17
|
-
@include media-breakpoint-down(sm) {
|
|
18
|
-
padding: 0;
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
.right-block {
|
|
23
|
-
margin-left: 0;
|
|
24
|
-
height: calc(100vh - 2rem);
|
|
25
|
-
max-height: calc(100vh - 1rem);
|
|
26
|
-
@include media-breakpoint-down(sm) {
|
|
27
|
-
width: calc(100% - 2rem);
|
|
28
|
-
max-width: unset;
|
|
29
|
-
position: inherit;
|
|
30
|
-
overflow: visible;
|
|
31
|
-
margin: 0 1rem 1rem;
|
|
32
|
-
height: unset;
|
|
33
|
-
min-height: unset;
|
|
34
|
-
max-height: 100%;
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
|
|
38
3
|
.left-block {
|
|
39
4
|
.left-block-container {
|
|
40
5
|
position: relative;
|
|
41
6
|
max-height: 100%;
|
|
42
7
|
|
|
43
|
-
.payment-title {
|
|
44
|
-
font-size: 0.875rem;
|
|
45
|
-
font-weight: 600;
|
|
46
|
-
align-items: center;
|
|
47
|
-
margin-left: 0.5rem;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
8
|
.ryft-payment-form {
|
|
51
9
|
.submit-button-wrapper {
|
|
52
10
|
margin: -1rem 0 1rem;
|
|
@@ -55,55 +13,7 @@
|
|
|
55
13
|
width: 100%;
|
|
56
14
|
}
|
|
57
15
|
}
|
|
58
|
-
#mobile-pay-divider-container {
|
|
59
|
-
display: flex;
|
|
60
|
-
position: relative;
|
|
61
|
-
margin-bottom: 1rem;
|
|
62
|
-
#mobile-pay-divider-text {
|
|
63
|
-
margin-right: 1rem;
|
|
64
|
-
font-size: 0.875rem;
|
|
65
|
-
font-weight: 600;
|
|
66
|
-
}
|
|
67
|
-
#mobile-pay-divider {
|
|
68
|
-
width: 100%;
|
|
69
|
-
border-bottom: 1px #dfdfdf solid;
|
|
70
|
-
margin-bottom: 0.6rem;
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
16
|
|
|
74
|
-
#card-title-container {
|
|
75
|
-
height: auto;
|
|
76
|
-
border: none;
|
|
77
|
-
margin-bottom: 0.5rem;
|
|
78
|
-
text-align: left;
|
|
79
|
-
:first-child {
|
|
80
|
-
font-size: 1rem;
|
|
81
|
-
font-weight: 600;
|
|
82
|
-
margin-bottom: 1rem;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.form-label {
|
|
86
|
-
margin-bottom: 0.5rem;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
.mobile-pay-title {
|
|
90
|
-
display: block;
|
|
91
|
-
font-weight: 600;
|
|
92
|
-
font-size: 1rem;
|
|
93
|
-
color: black;
|
|
94
|
-
padding: 0;
|
|
95
|
-
font-style: normal;
|
|
96
|
-
font-family: inherit;
|
|
97
|
-
margin-bottom: 1rem;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
.form {
|
|
101
|
-
.input {
|
|
102
|
-
border: 2px solid #525252 !important;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
.ryft-payment-form {
|
|
107
17
|
@include media-breakpoint-up(md) {
|
|
108
18
|
.submit-button-wrapper {
|
|
109
19
|
max-width: 15.5rem;
|
|
@@ -112,9 +22,10 @@
|
|
|
112
22
|
|
|
113
23
|
// it's style for Google and Apple pay container, for unknown reasons we can't move this html elements with appendChild or replaceChild
|
|
114
24
|
.ryft-pay-grid {
|
|
25
|
+
position: absolute !important;
|
|
26
|
+
top: 10rem;
|
|
115
27
|
width: 100%;
|
|
116
28
|
max-width: 15.5rem;
|
|
117
|
-
margin-bottom: 1rem;
|
|
118
29
|
}
|
|
119
30
|
.ryft-pay-apple-pay-button {
|
|
120
31
|
border-radius: 0.25rem;
|
|
@@ -125,36 +36,6 @@
|
|
|
125
36
|
display: none !important;
|
|
126
37
|
}
|
|
127
38
|
}
|
|
128
|
-
@include media-breakpoint-down(sm) {
|
|
129
|
-
.left-block-container {
|
|
130
|
-
max-height: 100%;
|
|
131
|
-
overflow: visible;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
@include media-breakpoint-down(sm) {
|
|
137
|
-
flex-direction: column-reverse;
|
|
138
|
-
overflow: scroll;
|
|
139
|
-
|
|
140
|
-
@include media-breakpoint-down(sm) {
|
|
141
|
-
.left-block {
|
|
142
|
-
min-height: 100%;
|
|
143
|
-
}
|
|
144
|
-
.right-block {
|
|
145
|
-
margin: 0 auto;
|
|
146
|
-
width: 100%;
|
|
147
|
-
.children-wrapper {
|
|
148
|
-
.accordion {
|
|
149
|
-
.collapse {
|
|
150
|
-
overflow: visible;
|
|
151
|
-
overflow-x: unset;
|
|
152
|
-
scrollbar-width: unset;
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
39
|
}
|
|
159
40
|
}
|
|
160
41
|
::-webkit-scrollbar {
|
|
@@ -181,7 +62,3 @@
|
|
|
181
62
|
}
|
|
182
63
|
}
|
|
183
64
|
}
|
|
184
|
-
|
|
185
|
-
#ryft-threeDSMethodIframe {
|
|
186
|
-
display: none;
|
|
187
|
-
}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
|
|
2
|
+
import { mount, shallow } from "enzyme";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { act } from "react-dom/test-utils";
|
|
5
|
+
import { QueryClientProvider } from "react-query";
|
|
6
|
+
import { Authorizer } from "../../src/auth/Authorizer";
|
|
7
|
+
import useAuthMock from "../__mock__/hooks/useAuthMock";
|
|
8
|
+
import useUserMock from "../__mock__/hooks/useUserMock";
|
|
9
|
+
import useAuthApi from "../__mock__/hooks/useAuthApi";
|
|
10
|
+
import { queryClient } from "../packages/react-query";
|
|
11
|
+
|
|
12
|
+
jest.mock("react-i18next", () => ({
|
|
13
|
+
Trans: jest.fn().mockReturnValue("test"),
|
|
14
|
+
useTranslation: () => ({
|
|
15
|
+
t: jest.fn((arg) => arg),
|
|
16
|
+
}),
|
|
17
|
+
}));
|
|
18
|
+
jest.mock("@licklist/plugins/dist/context/user/hooks/useAuth");
|
|
19
|
+
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
20
|
+
jest.mock("@licklist/plugins/dist/hooks/Api/useAuthApi");
|
|
21
|
+
|
|
22
|
+
const DEFAULT_PROFILE_RESPONSE = {
|
|
23
|
+
useProfile: () => ({
|
|
24
|
+
isLoading: false,
|
|
25
|
+
isFetching: false,
|
|
26
|
+
isError: false,
|
|
27
|
+
data: { access_token: "test" },
|
|
28
|
+
}),
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const DEFAULT_PROFILE_LOADING_RESPONSE = {
|
|
32
|
+
useProfile: () => ({
|
|
33
|
+
isLoading: true,
|
|
34
|
+
isFetching: false,
|
|
35
|
+
isError: false,
|
|
36
|
+
data: { access_token: "test" },
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
describe("Authorizer", () => {
|
|
41
|
+
it("should be rendered without issues", () => {
|
|
42
|
+
useAuthMock({
|
|
43
|
+
secrets: null,
|
|
44
|
+
});
|
|
45
|
+
useUserMock({
|
|
46
|
+
profile: null,
|
|
47
|
+
});
|
|
48
|
+
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
49
|
+
|
|
50
|
+
const component = shallow(
|
|
51
|
+
<QueryClientProvider client={queryClient}>
|
|
52
|
+
<Authorizer />
|
|
53
|
+
</QueryClientProvider>
|
|
54
|
+
);
|
|
55
|
+
|
|
56
|
+
expect(component.exists()).toBeTruthy();
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
it("should render children if authorized", () => {
|
|
60
|
+
let component: any;
|
|
61
|
+
|
|
62
|
+
useAuthMock({
|
|
63
|
+
secrets: "not-null",
|
|
64
|
+
});
|
|
65
|
+
useUserMock({
|
|
66
|
+
profile: "not-null",
|
|
67
|
+
});
|
|
68
|
+
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
69
|
+
|
|
70
|
+
RouteService.getCurrentPage = jest.fn();
|
|
71
|
+
RouteService.getCurrentRoute = jest.fn();
|
|
72
|
+
RouteService.cleanRedirect = jest.fn();
|
|
73
|
+
|
|
74
|
+
act(() => {
|
|
75
|
+
component = mount(
|
|
76
|
+
<QueryClientProvider client={queryClient}>
|
|
77
|
+
<Authorizer>
|
|
78
|
+
<p>test</p>
|
|
79
|
+
</Authorizer>
|
|
80
|
+
</QueryClientProvider>
|
|
81
|
+
);
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
component.update();
|
|
85
|
+
|
|
86
|
+
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
87
|
+
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
88
|
+
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
89
|
+
expect(component.exists()).toBeTruthy();
|
|
90
|
+
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
it("should render children if current page is login", () => {
|
|
94
|
+
let component: any;
|
|
95
|
+
|
|
96
|
+
useAuthMock({
|
|
97
|
+
secrets: null,
|
|
98
|
+
});
|
|
99
|
+
useUserMock({
|
|
100
|
+
profile: null,
|
|
101
|
+
});
|
|
102
|
+
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
103
|
+
|
|
104
|
+
RouteService.getCurrentPage = jest.fn().mockReturnValue("/login");
|
|
105
|
+
RouteService.getCurrentRoute = jest.fn();
|
|
106
|
+
RouteService.cleanRedirect = jest.fn();
|
|
107
|
+
|
|
108
|
+
act(() => {
|
|
109
|
+
component = mount(
|
|
110
|
+
<QueryClientProvider client={queryClient}>
|
|
111
|
+
<Authorizer>
|
|
112
|
+
<p>test</p>
|
|
113
|
+
</Authorizer>
|
|
114
|
+
</QueryClientProvider>
|
|
115
|
+
);
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
component.update();
|
|
119
|
+
|
|
120
|
+
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
121
|
+
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
122
|
+
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
123
|
+
expect(component.exists()).toBeTruthy();
|
|
124
|
+
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
it("should NOT render children if profile is loading or fetching", () => {
|
|
128
|
+
let component: any;
|
|
129
|
+
|
|
130
|
+
useAuthMock({
|
|
131
|
+
secrets: null,
|
|
132
|
+
});
|
|
133
|
+
useUserMock({
|
|
134
|
+
profile: null,
|
|
135
|
+
});
|
|
136
|
+
useAuthApi(DEFAULT_PROFILE_LOADING_RESPONSE);
|
|
137
|
+
|
|
138
|
+
RouteService.getCurrentPage = jest.fn();
|
|
139
|
+
RouteService.getCurrentRoute = jest.fn();
|
|
140
|
+
RouteService.cleanRedirect = jest.fn();
|
|
141
|
+
|
|
142
|
+
act(() => {
|
|
143
|
+
component = mount(
|
|
144
|
+
<QueryClientProvider client={queryClient}>
|
|
145
|
+
<Authorizer>
|
|
146
|
+
<p>test</p>
|
|
147
|
+
</Authorizer>
|
|
148
|
+
</QueryClientProvider>
|
|
149
|
+
);
|
|
150
|
+
});
|
|
151
|
+
|
|
152
|
+
component.update();
|
|
153
|
+
|
|
154
|
+
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(0);
|
|
155
|
+
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(0);
|
|
156
|
+
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(0);
|
|
157
|
+
expect(component.exists()).toBeTruthy();
|
|
158
|
+
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
159
|
+
});
|
|
160
|
+
|
|
161
|
+
it("should NOT render children if unauthorized and current page is not login", () => {
|
|
162
|
+
let component: any;
|
|
163
|
+
|
|
164
|
+
useAuthMock({
|
|
165
|
+
secrets: null,
|
|
166
|
+
});
|
|
167
|
+
useUserMock({
|
|
168
|
+
profile: null,
|
|
169
|
+
});
|
|
170
|
+
useAuthApi(DEFAULT_PROFILE_RESPONSE);
|
|
171
|
+
|
|
172
|
+
RouteService.getCurrentPage = jest.fn();
|
|
173
|
+
RouteService.getCurrentRoute = jest.fn();
|
|
174
|
+
RouteService.cleanRedirect = jest.fn();
|
|
175
|
+
|
|
176
|
+
act(() => {
|
|
177
|
+
component = mount(
|
|
178
|
+
<QueryClientProvider client={queryClient}>
|
|
179
|
+
<Authorizer>
|
|
180
|
+
<p>test</p>
|
|
181
|
+
</Authorizer>
|
|
182
|
+
</QueryClientProvider>
|
|
183
|
+
);
|
|
184
|
+
});
|
|
185
|
+
|
|
186
|
+
component.update();
|
|
187
|
+
|
|
188
|
+
expect(RouteService.getCurrentPage).toHaveBeenCalledTimes(3);
|
|
189
|
+
expect(RouteService.getCurrentRoute).toHaveBeenCalledTimes(1);
|
|
190
|
+
expect(RouteService.cleanRedirect).toHaveBeenCalledTimes(1);
|
|
191
|
+
expect(component.exists()).toBeTruthy();
|
|
192
|
+
expect(component.find("BlockLoader").exists()).toBeTruthy();
|
|
193
|
+
});
|
|
194
|
+
});
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
|
|
2
|
+
import { mount, shallow } from "enzyme";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import useTranslationMock from "../../__mock__/hooks/useTranslationMock";
|
|
5
|
+
import useUserMock from "../../__mock__/hooks/useUserMock";
|
|
6
|
+
import { UserNavDropDown } from "../../../src/auth/Layout/UserNavDropDown";
|
|
7
|
+
|
|
8
|
+
jest.mock("react-i18next");
|
|
9
|
+
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
10
|
+
|
|
11
|
+
describe("UserNavDropDown", () => {
|
|
12
|
+
it("should be rendered without issues", () => {
|
|
13
|
+
useTranslationMock({
|
|
14
|
+
t: jest.fn(),
|
|
15
|
+
});
|
|
16
|
+
useUserMock({
|
|
17
|
+
profile: null,
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
const component = shallow(<UserNavDropDown />);
|
|
21
|
+
|
|
22
|
+
expect(component.exists()).toBeTruthy();
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
it("should logout on click", () => {
|
|
26
|
+
useTranslationMock({
|
|
27
|
+
t: jest.fn(),
|
|
28
|
+
});
|
|
29
|
+
useUserMock({
|
|
30
|
+
logout: jest.fn(),
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
RouteService.redirectTo = jest.fn();
|
|
34
|
+
|
|
35
|
+
const component = mount(<UserNavDropDown />);
|
|
36
|
+
|
|
37
|
+
expect(component.exists()).toBeTruthy();
|
|
38
|
+
|
|
39
|
+
component.children().prop("onClick")();
|
|
40
|
+
|
|
41
|
+
expect(RouteService.redirectTo).toHaveBeenCalledTimes(1);
|
|
42
|
+
});
|
|
43
|
+
});
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { IUser } from "@licklist/plugins/dist/types/context/user/IUser";
|
|
2
|
+
import { shallow } from "enzyme";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { UserNavDropDownToggle } from "../../../src/auth/Layout/UserNavDropDownToggle";
|
|
5
|
+
import useTranslationMock from "../../__mock__/hooks/useTranslationMock";
|
|
6
|
+
|
|
7
|
+
jest.mock("react-i18next");
|
|
8
|
+
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
9
|
+
|
|
10
|
+
const user: IUser = {
|
|
11
|
+
id: 1,
|
|
12
|
+
first_name: "first_name",
|
|
13
|
+
last_name: "last_name",
|
|
14
|
+
email: "email",
|
|
15
|
+
user_roles: [],
|
|
16
|
+
user_detail: {
|
|
17
|
+
postcode: "",
|
|
18
|
+
birthday: "",
|
|
19
|
+
phone: "",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe("UserNavDropDownToggle", () => {
|
|
24
|
+
it("should be rendered without issues", () => {
|
|
25
|
+
useTranslationMock({
|
|
26
|
+
t: jest.fn(),
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const component = shallow(<UserNavDropDownToggle user={user} />);
|
|
30
|
+
|
|
31
|
+
expect(component.exists()).toBeTruthy();
|
|
32
|
+
});
|
|
33
|
+
});
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import RouteService from "@licklist/plugins/dist/services/Route/RouteService";
|
|
2
|
+
import { UserLoginRequest } from "@licklist/plugins/dist/types/Request/UserLoginRequest";
|
|
3
|
+
import { mount, shallow } from "enzyme";
|
|
4
|
+
import * as React from "react";
|
|
5
|
+
import { act } from "react-dom/test-utils";
|
|
6
|
+
import { MemoryRouter } from "react-router-dom";
|
|
7
|
+
import { LoginComponent, LoginFormComponent } from "../../../src/auth/Login";
|
|
8
|
+
import useAuthMock from "../../__mock__/hooks/useAuthMock";
|
|
9
|
+
import useFormMock from "../../__mock__/hooks/useFormMock";
|
|
10
|
+
import useNotificationMock from "../../__mock__/hooks/useNotificationMock";
|
|
11
|
+
import useTranslationMock from "../../__mock__/hooks/useTranslationMock";
|
|
12
|
+
import useUserApiMock from "../../__mock__/hooks/useUserApiMock";
|
|
13
|
+
import useUserMock from "../../__mock__/hooks/useUserMock";
|
|
14
|
+
|
|
15
|
+
jest.mock("react-i18next", () => ({
|
|
16
|
+
Trans: jest.fn().mockReturnValue("test"),
|
|
17
|
+
useTranslation: jest.fn(),
|
|
18
|
+
}));
|
|
19
|
+
jest.mock("react-hook-form");
|
|
20
|
+
jest.mock("@licklist/plugins/dist/context/app/hooks/useNotification");
|
|
21
|
+
jest.mock("@licklist/plugins/dist/context/user/hooks/useAuth");
|
|
22
|
+
jest.mock("@licklist/plugins/dist/context/user/hooks/useUser");
|
|
23
|
+
jest.mock("@licklist/plugins/dist/hooks/Api/useUserApi");
|
|
24
|
+
|
|
25
|
+
beforeEach(() => {
|
|
26
|
+
useTranslationMock();
|
|
27
|
+
useNotificationMock({
|
|
28
|
+
danger: jest.fn(),
|
|
29
|
+
success: jest.fn(),
|
|
30
|
+
});
|
|
31
|
+
useAuthMock({
|
|
32
|
+
setSecrets: jest.fn(),
|
|
33
|
+
});
|
|
34
|
+
useUserMock({
|
|
35
|
+
login: jest.fn(),
|
|
36
|
+
clearInvitation: jest.fn(),
|
|
37
|
+
});
|
|
38
|
+
useFormMock();
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
afterAll(() => {
|
|
42
|
+
jest.resetAllMocks();
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
describe("LoginComponent", () => {
|
|
46
|
+
it("should be rendered without issues", () => {
|
|
47
|
+
const component = shallow(
|
|
48
|
+
<MemoryRouter initialEntries={["/"]}>
|
|
49
|
+
<LoginComponent />
|
|
50
|
+
</MemoryRouter>
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
expect(component.exists()).toBeTruthy();
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("should show danger notification if login did not succeed", async () => {
|
|
57
|
+
let component: any;
|
|
58
|
+
|
|
59
|
+
const notificationDangerMock = jest.fn();
|
|
60
|
+
const notificationSuccessMock = jest.fn();
|
|
61
|
+
const loginMock = jest.fn(() => Promise.reject(new Error("danger")));
|
|
62
|
+
const profileMock = jest.fn();
|
|
63
|
+
|
|
64
|
+
useNotificationMock({
|
|
65
|
+
danger: notificationDangerMock,
|
|
66
|
+
success: notificationSuccessMock,
|
|
67
|
+
});
|
|
68
|
+
useUserApiMock({
|
|
69
|
+
login: loginMock,
|
|
70
|
+
profile: profileMock,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
RouteService.redirectTo = jest.fn();
|
|
74
|
+
|
|
75
|
+
act(() => {
|
|
76
|
+
component = mount(
|
|
77
|
+
<MemoryRouter>
|
|
78
|
+
<LoginComponent />
|
|
79
|
+
</MemoryRouter>
|
|
80
|
+
);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
await act(async () => {
|
|
84
|
+
const credentials: UserLoginRequest = {
|
|
85
|
+
email: "email",
|
|
86
|
+
password: "password",
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
await component.find(LoginFormComponent).prop("onSubmit")(credentials);
|
|
90
|
+
});
|
|
91
|
+
|
|
92
|
+
component.update();
|
|
93
|
+
|
|
94
|
+
expect(component.exists()).toBeTruthy();
|
|
95
|
+
expect(loginMock).toHaveBeenCalledTimes(1);
|
|
96
|
+
expect(notificationDangerMock).toHaveBeenCalledTimes(1);
|
|
97
|
+
expect(profileMock).toHaveBeenCalledTimes(0);
|
|
98
|
+
expect(notificationSuccessMock).toHaveBeenCalledTimes(0);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
it("should show danger notification if profile did not succeed", async () => {
|
|
102
|
+
let component: any;
|
|
103
|
+
|
|
104
|
+
const loginResponse = {
|
|
105
|
+
access_token: "access_token",
|
|
106
|
+
refresh_token: "refresh_token",
|
|
107
|
+
token_type: "token_type",
|
|
108
|
+
expires_in: null,
|
|
109
|
+
};
|
|
110
|
+
|
|
111
|
+
const notificationDangerMock = jest.fn();
|
|
112
|
+
const notificationSuccessMock = jest.fn();
|
|
113
|
+
const loginMock = jest.fn(() => Promise.resolve(loginResponse));
|
|
114
|
+
const profileMock = jest.fn(() => Promise.reject(new Error("danger")));
|
|
115
|
+
const setAuthorizationTokenMock = jest.fn();
|
|
116
|
+
const setSecretsMock = jest.fn();
|
|
117
|
+
|
|
118
|
+
useNotificationMock({
|
|
119
|
+
danger: notificationDangerMock,
|
|
120
|
+
success: notificationSuccessMock,
|
|
121
|
+
});
|
|
122
|
+
useUserApiMock({
|
|
123
|
+
login: loginMock,
|
|
124
|
+
profile: profileMock,
|
|
125
|
+
setAuthorizationToken: setAuthorizationTokenMock,
|
|
126
|
+
});
|
|
127
|
+
useAuthMock({
|
|
128
|
+
setSecrets: setSecretsMock,
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
RouteService.redirectTo = jest.fn();
|
|
132
|
+
|
|
133
|
+
act(() => {
|
|
134
|
+
component = mount(
|
|
135
|
+
<MemoryRouter>
|
|
136
|
+
<LoginComponent />
|
|
137
|
+
</MemoryRouter>
|
|
138
|
+
);
|
|
139
|
+
});
|
|
140
|
+
|
|
141
|
+
await act(async () => {
|
|
142
|
+
const credentials: UserLoginRequest = {
|
|
143
|
+
email: "email",
|
|
144
|
+
password: "password",
|
|
145
|
+
};
|
|
146
|
+
|
|
147
|
+
await component.find(LoginFormComponent).prop("onSubmit")(credentials);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
component.update();
|
|
151
|
+
|
|
152
|
+
expect(component.exists()).toBeTruthy();
|
|
153
|
+
expect(loginMock).toHaveBeenCalledTimes(1);
|
|
154
|
+
expect(setSecretsMock).toHaveBeenCalledTimes(1);
|
|
155
|
+
expect(setSecretsMock).toHaveBeenCalledWith(loginResponse);
|
|
156
|
+
expect(setAuthorizationTokenMock).toHaveBeenCalledTimes(1);
|
|
157
|
+
expect(setAuthorizationTokenMock).toHaveBeenCalledWith(
|
|
158
|
+
loginResponse.access_token
|
|
159
|
+
);
|
|
160
|
+
expect(profileMock).toHaveBeenCalledTimes(1);
|
|
161
|
+
expect(notificationDangerMock).toHaveBeenCalledTimes(1);
|
|
162
|
+
expect(notificationSuccessMock).toHaveBeenCalledTimes(0);
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it("should show success notification if login and profile did succeed", async () => {
|
|
166
|
+
let component: any;
|
|
167
|
+
|
|
168
|
+
const loginResponse = {
|
|
169
|
+
access_token: "access_token",
|
|
170
|
+
refresh_token: "refresh_token",
|
|
171
|
+
token_type: "token_type",
|
|
172
|
+
expires_in: null,
|
|
173
|
+
};
|
|
174
|
+
const profileResponse = {
|
|
175
|
+
id: 1,
|
|
176
|
+
first_name: "first_name",
|
|
177
|
+
last_name: "last_name",
|
|
178
|
+
email: "email",
|
|
179
|
+
role: null,
|
|
180
|
+
};
|
|
181
|
+
|
|
182
|
+
const notificationDangerMock = jest.fn();
|
|
183
|
+
const notificationSuccessMock = jest.fn();
|
|
184
|
+
const loginMock = jest.fn(() => Promise.resolve(loginResponse));
|
|
185
|
+
const profileMock = jest.fn(() =>
|
|
186
|
+
Promise.resolve({
|
|
187
|
+
data: profileResponse,
|
|
188
|
+
})
|
|
189
|
+
);
|
|
190
|
+
const setAuthorizationTokenMock = jest.fn();
|
|
191
|
+
const setSecretsMock = jest.fn();
|
|
192
|
+
const userLoginMock = jest.fn();
|
|
193
|
+
|
|
194
|
+
useNotificationMock({
|
|
195
|
+
danger: notificationDangerMock,
|
|
196
|
+
success: notificationSuccessMock,
|
|
197
|
+
});
|
|
198
|
+
useUserApiMock({
|
|
199
|
+
login: loginMock,
|
|
200
|
+
profile: profileMock,
|
|
201
|
+
setAuthorizationToken: setAuthorizationTokenMock,
|
|
202
|
+
});
|
|
203
|
+
useAuthMock({
|
|
204
|
+
setSecrets: setSecretsMock,
|
|
205
|
+
});
|
|
206
|
+
useUserMock({
|
|
207
|
+
login: userLoginMock,
|
|
208
|
+
});
|
|
209
|
+
|
|
210
|
+
RouteService.redirectTo = jest.fn();
|
|
211
|
+
|
|
212
|
+
act(() => {
|
|
213
|
+
component = mount(
|
|
214
|
+
<MemoryRouter>
|
|
215
|
+
<LoginComponent />
|
|
216
|
+
</MemoryRouter>
|
|
217
|
+
);
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
await act(async () => {
|
|
221
|
+
const credentials: UserLoginRequest = {
|
|
222
|
+
email: "email",
|
|
223
|
+
password: "password",
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
await component.find(LoginFormComponent).prop("onSubmit")(credentials);
|
|
227
|
+
});
|
|
228
|
+
|
|
229
|
+
component.update();
|
|
230
|
+
|
|
231
|
+
expect(component.exists()).toBeTruthy();
|
|
232
|
+
expect(loginMock).toHaveBeenCalledTimes(1);
|
|
233
|
+
expect(setSecretsMock).toHaveBeenCalledTimes(1);
|
|
234
|
+
expect(setSecretsMock).toHaveBeenCalledWith(loginResponse);
|
|
235
|
+
expect(setAuthorizationTokenMock).toHaveBeenCalledTimes(1);
|
|
236
|
+
expect(setAuthorizationTokenMock).toHaveBeenCalledWith(
|
|
237
|
+
loginResponse.access_token
|
|
238
|
+
);
|
|
239
|
+
expect(profileMock).toHaveBeenCalledTimes(1);
|
|
240
|
+
expect(userLoginMock).toHaveBeenCalledTimes(1);
|
|
241
|
+
expect(userLoginMock).toHaveBeenCalledWith(profileResponse);
|
|
242
|
+
expect(notificationDangerMock).toHaveBeenCalledTimes(0);
|
|
243
|
+
expect(notificationSuccessMock).toHaveBeenCalledTimes(1);
|
|
244
|
+
expect(RouteService.redirectTo).toHaveBeenCalledTimes(1);
|
|
245
|
+
});
|
|
246
|
+
});
|