@diia-inhouse/test 6.6.4 → 7.3.0
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/LICENCE.md +59 -59
- package/dist/dbUtilsBuilder.js +116 -0
- package/dist/dbUtilsBuilder.js.map +1 -0
- package/dist/documentsGenerator.js.map +1 -1
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/dist/interfaces/documents/foreignPassport.js.map +1 -1
- package/dist/interfaces/documents/index.js.map +1 -1
- package/dist/publicServiceGenerator.js +3 -5
- package/dist/publicServiceGenerator.js.map +1 -1
- package/dist/sessionGenerator.js +7 -24
- package/dist/sessionGenerator.js.map +1 -1
- package/dist/stubs/documents/foreignPassport.js +17 -2
- package/dist/stubs/documents/foreignPassport.js.map +1 -1
- package/dist/stubs/documents/index.js +2 -2
- package/dist/stubs/documents/index.js.map +1 -1
- package/dist/stubs/documents/internalPassport.js +17 -2
- package/dist/stubs/documents/internalPassport.js.map +1 -1
- package/dist/types/dbUtilsBuilder.d.ts +29 -0
- package/dist/types/index.d.ts +1 -1
- package/dist/types/interfaces/documents/foreignPassport.d.ts +2 -1
- package/dist/types/interfaces/documents/index.d.ts +15 -0
- package/dist/types/interfaces/documents/internalPassport.d.ts +2 -1
- package/dist/types/publicServiceGenerator.d.ts +1 -1
- package/dist/types/sessionGenerator.d.ts +4 -5
- package/package.json +34 -38
- package/vitest/extend-expect.ts +25 -0
- package/vitest/interfaces/index.ts +8 -0
- package/vitest/matchers/designSystem/atoms/amountAtm.ts +13 -0
- package/vitest/matchers/designSystem/atoms/articlePicAtm.ts +12 -0
- package/vitest/matchers/designSystem/atoms/badgeCounterAtm.ts +11 -0
- package/vitest/matchers/designSystem/atoms/btnLinkAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/btnLoadPlainIconAtm.ts +19 -0
- package/vitest/matchers/designSystem/atoms/btnPlainAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/btnPlainIconAtm.ts +18 -0
- package/vitest/matchers/designSystem/atoms/btnPrimaryAdditionalAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/btnPrimaryDefaultAtm.ts +17 -0
- package/vitest/matchers/designSystem/atoms/btnPrimaryLargeAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/btnPrimaryWideAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/btnSemiLightAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/btnStrokeAdditionalAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/btnStrokeDefaultAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/btnWhiteAdditionalIconAtm.ts +20 -0
- package/vitest/matchers/designSystem/atoms/calendarItemAtm.ts +14 -0
- package/vitest/matchers/designSystem/atoms/chipStatusAtm.ts +14 -0
- package/vitest/matchers/designSystem/atoms/dotNavigationAtm.ts +11 -0
- package/vitest/matchers/designSystem/atoms/doubleIconAtm.ts +15 -0
- package/vitest/matchers/designSystem/atoms/greyTitleAtm.ts +12 -0
- package/vitest/matchers/designSystem/atoms/iconAtm.ts +12 -0
- package/vitest/matchers/designSystem/atoms/index.ts +65 -0
- package/vitest/matchers/designSystem/atoms/inputNumberLargeAtm.ts +15 -0
- package/vitest/matchers/designSystem/atoms/largeIconAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/playerBtnAtm.ts +12 -0
- package/vitest/matchers/designSystem/atoms/sectionTitleAtm.ts +11 -0
- package/vitest/matchers/designSystem/atoms/shared/buttonAction.ts +15 -0
- package/vitest/matchers/designSystem/atoms/shared/iconAction.ts +13 -0
- package/vitest/matchers/designSystem/atoms/simpleIconAtm.ts +12 -0
- package/vitest/matchers/designSystem/atoms/smallIconAtm.ts +16 -0
- package/vitest/matchers/designSystem/atoms/textParameterAtm.ts +19 -0
- package/vitest/matchers/designSystem/atoms/tickerAtm.ts +20 -0
- package/vitest/matchers/designSystem/atoms/userPictureAtm.ts +14 -0
- package/vitest/matchers/designSystem/atoms/validationAtm.ts +13 -0
- package/vitest/matchers/designSystem/enums/button.ts +5 -0
- package/vitest/matchers/designSystem/enums/icon.ts +5 -0
- package/vitest/matchers/designSystem/index.ts +7 -0
- package/vitest/matchers/designSystem/molecules/articleVideoMlc.ts +13 -0
- package/vitest/matchers/designSystem/molecules/attentionIconMessageMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/attentionMessageMlc.ts +18 -0
- package/vitest/matchers/designSystem/molecules/barCodeMlc.ts +12 -0
- package/vitest/matchers/designSystem/molecules/blackCardMlc.ts +20 -0
- package/vitest/matchers/designSystem/molecules/btnIconPlainGroupMlc.ts +17 -0
- package/vitest/matchers/designSystem/molecules/btnIconRoundedMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/btnLoadIconPlainGroupMlc.ts +17 -0
- package/vitest/matchers/designSystem/molecules/btnToggleMlc.ts +26 -0
- package/vitest/matchers/designSystem/molecules/cardMlc.ts +33 -0
- package/vitest/matchers/designSystem/molecules/cardMlcTicker.ts +12 -0
- package/vitest/matchers/designSystem/molecules/checkIconMlc.ts +13 -0
- package/vitest/matchers/designSystem/molecules/checkboxRoundMlc.ts +11 -0
- package/vitest/matchers/designSystem/molecules/checkboxSquareMlc.ts +22 -0
- package/vitest/matchers/designSystem/molecules/chipMlc.ts +22 -0
- package/vitest/matchers/designSystem/molecules/chipTimeMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/currentTimeMlc.ts +20 -0
- package/vitest/matchers/designSystem/molecules/dashboardCardMlc.ts +23 -0
- package/vitest/matchers/designSystem/molecules/docNumberCopyMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/docNumberCopyWhiteMlc.ts +14 -0
- package/vitest/matchers/designSystem/molecules/docTableItemHorizontalLongerMlc.ts +18 -0
- package/vitest/matchers/designSystem/molecules/docTableItemHorizontalMlc.ts +19 -0
- package/vitest/matchers/designSystem/molecules/halvedCardMlc.ts +21 -0
- package/vitest/matchers/designSystem/molecules/headingWithSubtitleWhiteMlc.ts +12 -0
- package/vitest/matchers/designSystem/molecules/headingWithSubtitlesMlc.ts +13 -0
- package/vitest/matchers/designSystem/molecules/iconCardMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/imageCardMlc.ts +21 -0
- package/vitest/matchers/designSystem/molecules/index.ts +121 -0
- package/vitest/matchers/designSystem/molecules/inputDateMlc.ts +19 -0
- package/vitest/matchers/designSystem/molecules/inputNumberFractionalMlc.ts +21 -0
- package/vitest/matchers/designSystem/molecules/inputNumberLargeMlc.ts +17 -0
- package/vitest/matchers/designSystem/molecules/inputNumberMlc.ts +20 -0
- package/vitest/matchers/designSystem/molecules/inputTextMlc.ts +21 -0
- package/vitest/matchers/designSystem/molecules/inputTextMultilineMlc.ts +21 -0
- package/vitest/matchers/designSystem/molecules/listItemMlc.ts +32 -0
- package/vitest/matchers/designSystem/molecules/listWidgetItemMlc.ts +24 -0
- package/vitest/matchers/designSystem/molecules/navigationPanelMlc.ts +49 -0
- package/vitest/matchers/designSystem/molecules/qrCodeMlc.ts +12 -0
- package/vitest/matchers/designSystem/molecules/radioBtnMlc.ts +28 -0
- package/vitest/matchers/designSystem/molecules/searchInputMlc.ts +19 -0
- package/vitest/matchers/designSystem/molecules/smallEmojiPanelMlc.ts +13 -0
- package/vitest/matchers/designSystem/molecules/smallEmojiPanelPlaneMlc.ts +13 -0
- package/vitest/matchers/designSystem/molecules/smallNotificationMlc.ts +20 -0
- package/vitest/matchers/designSystem/molecules/stackMlc.ts +13 -0
- package/vitest/matchers/designSystem/molecules/statusMessageMlc.ts +16 -0
- package/vitest/matchers/designSystem/molecules/stubMessageMlc.ts +18 -0
- package/vitest/matchers/designSystem/molecules/subtitleLabelMlc.ts +14 -0
- package/vitest/matchers/designSystem/molecules/tableItemHorizontalLargeMlc.ts +22 -0
- package/vitest/matchers/designSystem/molecules/tableItemHorizontalMlc.ts +19 -0
- package/vitest/matchers/designSystem/molecules/tableItemMlc.ts +23 -0
- package/vitest/matchers/designSystem/molecules/tableItemPrimaryMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/tableItemVerticalMlc.ts +22 -0
- package/vitest/matchers/designSystem/molecules/tableMainHeadingMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/tableSecondaryHeadingMlc.ts +14 -0
- package/vitest/matchers/designSystem/molecules/textLabelContainerMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/textLabelMlc.ts +23 -0
- package/vitest/matchers/designSystem/molecules/timerMlc.ts +36 -0
- package/vitest/matchers/designSystem/molecules/titleGroupMlc.ts +27 -0
- package/vitest/matchers/designSystem/molecules/titleLabelMlc.ts +12 -0
- package/vitest/matchers/designSystem/molecules/userCardMlc.ts +15 -0
- package/vitest/matchers/designSystem/molecules/verticalCardMlc.ts +22 -0
- package/vitest/matchers/designSystem/molecules/whiteCardMlc.ts +19 -0
- package/vitest/matchers/designSystem/organisms/articlePicCarouselOrg.ts +20 -0
- package/vitest/matchers/designSystem/organisms/bottomGroupOrg.ts +25 -0
- package/vitest/matchers/designSystem/organisms/btnIconRoundedGroupOrg.ts +16 -0
- package/vitest/matchers/designSystem/organisms/calendarItemOrg.ts +16 -0
- package/vitest/matchers/designSystem/organisms/checkboxBtnOrg.ts +21 -0
- package/vitest/matchers/designSystem/organisms/checkboxRoundGroupOrg.ts +22 -0
- package/vitest/matchers/designSystem/organisms/chipGroupOrg.ts +21 -0
- package/vitest/matchers/designSystem/organisms/chipTabsOrg.ts +22 -0
- package/vitest/matchers/designSystem/organisms/dashboardCardTileOrg.ts +17 -0
- package/vitest/matchers/designSystem/organisms/docButtonHeadingOrg.ts +20 -0
- package/vitest/matchers/designSystem/organisms/docHeadingOrg.ts +19 -0
- package/vitest/matchers/designSystem/organisms/editAutomaticallyDeterminedValueOrg.ts +18 -0
- package/vitest/matchers/designSystem/organisms/fileUploadGroupOrg.ts +17 -0
- package/vitest/matchers/designSystem/organisms/fullScreenVideoOrg.ts +17 -0
- package/vitest/matchers/designSystem/organisms/groupFilesAddOrg.ts +19 -0
- package/vitest/matchers/designSystem/organisms/halvedCardCarouselOrg.ts +20 -0
- package/vitest/matchers/designSystem/organisms/index.ts +83 -0
- package/vitest/matchers/designSystem/organisms/inputDateTimeOrg.ts +16 -0
- package/vitest/matchers/designSystem/organisms/inputNumLargeTimeOrg.ts +19 -0
- package/vitest/matchers/designSystem/organisms/listItemGroupOrg.ts +11 -0
- package/vitest/matchers/designSystem/organisms/mediaTitleOrg.ts +14 -0
- package/vitest/matchers/designSystem/organisms/mediaUploadGroupOrg.ts +16 -0
- package/vitest/matchers/designSystem/organisms/paginationListOrg.ts +19 -0
- package/vitest/matchers/designSystem/organisms/paginationListWhiteOrg.ts +20 -0
- package/vitest/matchers/designSystem/organisms/paymentInfoOrg.ts +23 -0
- package/vitest/matchers/designSystem/organisms/questionFormsOrg.ts +28 -0
- package/vitest/matchers/designSystem/organisms/radioBtnAdditionalInputOrg.ts +14 -0
- package/vitest/matchers/designSystem/organisms/radioBtnGroupOrg.ts +28 -0
- package/vitest/matchers/designSystem/organisms/radioBtnWithAltOrg.ts +17 -0
- package/vitest/matchers/designSystem/organisms/searchBarOrg.ts +15 -0
- package/vitest/matchers/designSystem/organisms/selectorListWidgetOrg.ts +16 -0
- package/vitest/matchers/designSystem/organisms/selectorOrg.ts +24 -0
- package/vitest/matchers/designSystem/organisms/sharingCodesOrg.ts +24 -0
- package/vitest/matchers/designSystem/organisms/smallNotificationCarouselOrg.ts +20 -0
- package/vitest/matchers/designSystem/organisms/tableBlockAccordionOrg.ts +15 -0
- package/vitest/matchers/designSystem/organisms/tableBlockOrg.ts +17 -0
- package/vitest/matchers/designSystem/organisms/tableBlockPlaneOrg.ts +17 -0
- package/vitest/matchers/designSystem/organisms/tableBlockTwoColumnsOrg.ts +15 -0
- package/vitest/matchers/designSystem/organisms/tableBlockTwoColumnsPlaneOrg.ts +16 -0
- package/vitest/matchers/designSystem/organisms/toggleButtonGroupOrg.ts +18 -0
- package/vitest/matchers/designSystem/organisms/topGroupOrg.ts +17 -0
- package/vitest/matchers/designSystem/organisms/verificationCodesOrg.ts +31 -0
- package/vitest/matchers/designSystem/organisms/verticalCardCarouselOrg.ts +16 -0
- package/vitest/matchers/designSystem/utils.ts +14 -0
- package/vitest/matchers/index.ts +21 -0
- package/vitest/matchers/toBe.ts +38 -0
- package/vitest/matchers/toBeAttentionMessage/index.ts +19 -0
- package/vitest/matchers/toBeAttentionMessage/interfaces.ts +8 -0
- package/vitest/matchers/toBeAttentionMessageParameter.ts +20 -0
- package/vitest/matchers/toBeContextMenu/index.ts +25 -0
- package/vitest/matchers/toBeContextMenu/interfaces.ts +9 -0
- package/vitest/matchers/toBeDesignSystemElement/index.ts +8 -0
- package/vitest/matchers/toBeMainButton/index.ts +19 -0
- package/vitest/matchers/toBeMainButton/interfaces.ts +5 -0
- package/vitest/matchers/toBeNavigationPanel/index.ts +17 -0
- package/vitest/matchers/toBeNavigationPanel/interfaces.ts +6 -0
- package/vitest/matchers/toBeTextWithParameters/index.ts +17 -0
- package/vitest/matchers/toBeTextWithParameters/interfaces.ts +6 -0
- package/vitest/matchers/toBeValueWithLabel/index.ts +18 -0
- package/vitest/matchers/toBeValueWithLabel/interfaces.ts +4 -0
- package/vitest/matchers/toContainObjects.ts +17 -0
- package/vitest/matchers/toEqual.ts +26 -0
- package/vitest/matchers/toInterceptorsBeDone.ts +18 -0
- package/vitest/tsconfig.json +9 -0
- package/vitest/utils.ts +144 -0
- package/dist/mock.js +0 -44
- package/dist/mock.js.map +0 -1
- package/dist/mongooseMock.js +0 -43
- package/dist/mongooseMock.js.map +0 -1
- package/dist/types/mock.d.ts +0 -20
- package/dist/types/mongooseMock.d.ts +0 -33
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { NodePgDatabase } from 'drizzle-orm/node-postgres';
|
|
2
|
+
type DatabaseAdapterType = 'mongo' | 'postgres';
|
|
3
|
+
type DbUtils<TFactory extends Record<string, (data?: any) => any>, TEntitySchema extends {
|
|
4
|
+
[K in keyof TFactory]: ReturnType<TFactory[K]>;
|
|
5
|
+
}, TEntityName extends keyof TEntitySchema & keyof TFactory & string, TDbReference extends Partial<Record<TEntityName, Partial<Record<DatabaseAdapterType, any>>>>, TSavableEntity extends keyof TDbReference> = {
|
|
6
|
+
[K in TEntityName]: {
|
|
7
|
+
seed: {
|
|
8
|
+
make: (data?: Partial<TEntitySchema[K]>) => TEntitySchema[K];
|
|
9
|
+
many: (count: number) => {
|
|
10
|
+
make: (data?: Partial<TEntitySchema[K]>) => TEntitySchema[K][];
|
|
11
|
+
} & (K extends TSavableEntity ? {
|
|
12
|
+
save: (data?: Partial<TEntitySchema[K]>) => Promise<TEntitySchema[K][]>;
|
|
13
|
+
} : {});
|
|
14
|
+
} & (K extends TSavableEntity ? {
|
|
15
|
+
save: (data?: Partial<TEntitySchema[K]>) => Promise<TEntitySchema[K]>;
|
|
16
|
+
} : {});
|
|
17
|
+
} & (K extends TSavableEntity ? {
|
|
18
|
+
cleanupBy: <P extends keyof TEntitySchema[K]>(by: P, values: TEntitySchema[K][P][]) => Promise<TEntitySchema[K][]>;
|
|
19
|
+
updateBy: <P extends keyof TEntitySchema[K]>(by: P, values: TEntitySchema[K][P][], data: Partial<TEntitySchema[K]>) => Promise<TEntitySchema[K][]>;
|
|
20
|
+
} : {});
|
|
21
|
+
};
|
|
22
|
+
type DbUtilsParams = {
|
|
23
|
+
databaseAdapter: DatabaseAdapterType;
|
|
24
|
+
db?: NodePgDatabase<Record<string, unknown>>;
|
|
25
|
+
};
|
|
26
|
+
export declare function buildDbUtilsFn<TFactory extends Record<string, (data?: any) => any>, TEntitySchema extends {
|
|
27
|
+
[K in keyof TFactory]: ReturnType<TFactory[K]>;
|
|
28
|
+
}, TEntityName extends keyof TEntitySchema & keyof TFactory & string, TDbReference extends Partial<Record<TEntityName, Partial<Record<DatabaseAdapterType, any>>>>, TSavableEntity extends keyof TDbReference>(factories: TFactory, references: TDbReference): ({ databaseAdapter, db }: DbUtilsParams) => DbUtils<TFactory, TEntitySchema, TEntityName, TDbReference, TSavableEntity>;
|
|
29
|
+
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -2,7 +2,6 @@ import DocumentsGenerator from './documentsGenerator';
|
|
|
2
2
|
import PublicServiceGenerator from './publicServiceGenerator';
|
|
3
3
|
import RandomGenerator from './randomGenerator';
|
|
4
4
|
import SessionGenerator from './sessionGenerator';
|
|
5
|
-
export { mockClass, mockAnyClass, mockInstance } from './mock';
|
|
6
5
|
export default class TestKit {
|
|
7
6
|
readonly session: SessionGenerator;
|
|
8
7
|
readonly random: RandomGenerator;
|
|
@@ -11,3 +10,4 @@ export default class TestKit {
|
|
|
11
10
|
constructor();
|
|
12
11
|
}
|
|
13
12
|
export { default as SessionGenerator } from './sessionGenerator';
|
|
13
|
+
export { buildDbUtilsFn } from './dbUtilsBuilder';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import { DocStatus, DocumentBaseData, DocumentMetaData, DocumentTicker, Localization, NameValue } from '.';
|
|
1
2
|
import { TaxpayerCardInDocument } from './taxpayerCard';
|
|
2
|
-
import { DocStatus, DocumentMetaData, DocumentTicker, Localization, NameValue } from '.';
|
|
3
3
|
export declare enum PassportGenderEN {
|
|
4
4
|
F = "F",
|
|
5
5
|
M = "M"
|
|
@@ -13,6 +13,7 @@ export declare enum PassportType {
|
|
|
13
13
|
P = "P"
|
|
14
14
|
}
|
|
15
15
|
export interface BasePassport extends DocumentMetaData {
|
|
16
|
+
baseData: DocumentBaseData;
|
|
16
17
|
id: string;
|
|
17
18
|
docNumber: string;
|
|
18
19
|
series?: string;
|
|
@@ -2,6 +2,21 @@ export declare enum OwnerType {
|
|
|
2
2
|
owner = "owner",
|
|
3
3
|
properUser = "properUser"
|
|
4
4
|
}
|
|
5
|
+
export interface DocumentBaseData {
|
|
6
|
+
id: string;
|
|
7
|
+
number: string;
|
|
8
|
+
status: number;
|
|
9
|
+
name: string;
|
|
10
|
+
documentType: string;
|
|
11
|
+
documentTypeCamelCase: string;
|
|
12
|
+
ownerType: OwnerType;
|
|
13
|
+
listName?: string;
|
|
14
|
+
subtype?: string;
|
|
15
|
+
/** iso */
|
|
16
|
+
issuedAt?: string;
|
|
17
|
+
/** iso */
|
|
18
|
+
expiresAt?: string;
|
|
19
|
+
}
|
|
5
20
|
export interface NameValue {
|
|
6
21
|
name: string;
|
|
7
22
|
value: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocStatus, DocumentMetaData, Localization } from '.';
|
|
1
|
+
import { DocStatus, DocumentBaseData, DocumentMetaData, Localization } from '.';
|
|
2
2
|
export declare enum PassportGenderEN {
|
|
3
3
|
F = "F",
|
|
4
4
|
M = "M"
|
|
@@ -13,6 +13,7 @@ export declare enum PassportType {
|
|
|
13
13
|
}
|
|
14
14
|
export interface BasePassport extends DocumentMetaData {
|
|
15
15
|
id: string;
|
|
16
|
+
baseData: DocumentBaseData;
|
|
16
17
|
docNumber: string;
|
|
17
18
|
series?: string;
|
|
18
19
|
number: string;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicServiceContextMenu, PublicServiceSettings } from '@diia-inhouse/
|
|
1
|
+
import { PublicServiceContextMenu, PublicServiceSettings } from '@diia-inhouse/design-system';
|
|
2
2
|
export default class PublicServiceGenerator {
|
|
3
3
|
getPublicServiceContextMenu(contextMenuItems?: PublicServiceContextMenu[]): PublicServiceContextMenu[];
|
|
4
4
|
getPublicServiceSettings(serviceSettings?: Partial<PublicServiceSettings>): PublicServiceSettings;
|
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
import { AcquirerSession, AcquirerTokenData, ActionSession, AppUserActionHeaders, AuthEntryPoint,
|
|
1
|
+
import { AcquirerSession, AcquirerTokenData, ActionSession, AppUserActionHeaders, AuthEntryPoint, DiiaOfficeUserSession, EResidentApplicantSession, EResidentApplicantTokenData, EResidentSession, EResidentTokenData, Gender, PartnerSession, PartnerTokenData, PortalUserSession, PortalUserTokenData, ServiceEntranceSession, ServiceEntranceTokenData, ServiceUserSession, ServiceUserTokenData, SessionType, TemporarySession, TemporaryTokenData, UserActionArguments, UserSession, UserTokenData } from '@diia-inhouse/types';
|
|
2
2
|
import { GetUserActionArgumentsOps } from './interfaces';
|
|
3
3
|
import RandomGenerator from './randomGenerator';
|
|
4
4
|
export default class SessionGenerator {
|
|
5
5
|
private readonly random;
|
|
6
|
-
constructor(random: RandomGenerator);
|
|
7
6
|
private readonly dateFormat;
|
|
7
|
+
constructor(random: RandomGenerator);
|
|
8
8
|
getUserActionArguments(user?: Partial<UserTokenData>, headers?: Partial<AppUserActionHeaders>, ops?: GetUserActionArgumentsOps): UserActionArguments;
|
|
9
9
|
getAuthEntryPoint(authEntryPoint?: Partial<AuthEntryPoint>): AuthEntryPoint;
|
|
10
10
|
getUserSession(tokenData?: Partial<UserTokenData>, validItn?: boolean): UserSession;
|
|
11
11
|
getDiiaOfficeUserSession(tokenData?: Partial<UserTokenData>, validItn?: boolean, features?: Record<string, unknown>): DiiaOfficeUserSession;
|
|
12
|
-
getCabinetUserSession(tokenData?: Partial<CabinetUserTokenData>, validItn?: boolean): CabinetUserSession;
|
|
13
12
|
getEResidentSession(tokenData?: Partial<EResidentTokenData>, validItn?: boolean): EResidentSession;
|
|
14
13
|
getEResidentApplicantSession(tokenData?: Partial<EResidentApplicantTokenData>): EResidentApplicantSession;
|
|
15
14
|
/** @deprecated use getAcquirerSessionStringId after diia-app v15 */
|
|
16
15
|
getAcquirerSession(tokenData?: Partial<AcquirerTokenData>): AcquirerSession;
|
|
17
|
-
getAcquirerSessionStringId(tokenData?: Partial<AcquirerTokenData
|
|
16
|
+
getAcquirerSessionStringId(tokenData?: Partial<AcquirerTokenData>): AcquirerSession;
|
|
18
17
|
/** @deprecated use getPartnerSessionStringId after diia-app v15 */
|
|
19
18
|
getPartnerSession(tokenData?: Partial<PartnerTokenData>): PartnerSession;
|
|
20
|
-
getPartnerSessionStringId(tokenData?: Partial<PartnerTokenData
|
|
19
|
+
getPartnerSessionStringId(tokenData?: Partial<PartnerTokenData>): PartnerSession;
|
|
21
20
|
getTemporarySession(tokenData?: Partial<TemporaryTokenData>): TemporarySession;
|
|
22
21
|
getServiceEntranceSession(tokenData?: Partial<ServiceEntranceTokenData>): ServiceEntranceSession;
|
|
23
22
|
getPortalUserSession(tokenData?: Partial<PortalUserTokenData>, validItn?: boolean): PortalUserSession;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@diia-inhouse/test",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"description": "test-utils",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"author": "Diia",
|
|
@@ -11,15 +11,14 @@
|
|
|
11
11
|
"prepare": "npm run build",
|
|
12
12
|
"semantic-release": "semantic-release",
|
|
13
13
|
"start": "npm run build && node dist/index.js",
|
|
14
|
-
"lint": "eslint
|
|
15
|
-
"lint-fix": "eslint
|
|
14
|
+
"lint": "eslint . && prettier --check .",
|
|
15
|
+
"lint-fix": "eslint . --fix && prettier --write .",
|
|
16
16
|
"lint:lockfile": "lockfile-lint --path package-lock.json --allowed-hosts registry.npmjs.org --validate-https",
|
|
17
|
-
"test": "jest",
|
|
18
|
-
"test:unit": "npm run test --selectProjects unit --",
|
|
19
17
|
"find-circulars": "madge --circular --extensions ts ./"
|
|
20
18
|
},
|
|
21
19
|
"files": [
|
|
22
|
-
"dist"
|
|
20
|
+
"dist",
|
|
21
|
+
"vitest"
|
|
23
22
|
],
|
|
24
23
|
"exports": {
|
|
25
24
|
".": {
|
|
@@ -27,53 +26,56 @@
|
|
|
27
26
|
"require": "./dist/index.js",
|
|
28
27
|
"types": "./dist/types/index.d.ts"
|
|
29
28
|
},
|
|
30
|
-
"./
|
|
31
|
-
"
|
|
32
|
-
"require": "./dist/mongooseMock.js",
|
|
33
|
-
"types": "./dist/types/mongooseMock.d.ts"
|
|
29
|
+
"./vitest": {
|
|
30
|
+
"default": "./vitest/extend-expect.ts"
|
|
34
31
|
}
|
|
35
32
|
},
|
|
36
33
|
"typesVersions": {
|
|
37
34
|
"*": {
|
|
38
35
|
"*": [
|
|
39
36
|
"dist/types/index.d.ts"
|
|
40
|
-
],
|
|
41
|
-
"mongooseMock": [
|
|
42
|
-
"dist/types/mongooseMock.d.ts"
|
|
43
37
|
]
|
|
44
38
|
}
|
|
45
39
|
},
|
|
46
40
|
"engines": {
|
|
47
|
-
"node": ">=
|
|
41
|
+
"node": ">=22"
|
|
48
42
|
},
|
|
49
43
|
"keywords": [],
|
|
50
44
|
"dependencies": {
|
|
51
|
-
"
|
|
52
|
-
"
|
|
53
|
-
"
|
|
54
|
-
"lodash": "4.17.
|
|
55
|
-
"luxon": "3.
|
|
56
|
-
"
|
|
45
|
+
"@diia-inhouse/design-system": "3.9.0",
|
|
46
|
+
"@vitest/expect": "4.0.16",
|
|
47
|
+
"glob": "10.5.0",
|
|
48
|
+
"lodash": "4.17.23",
|
|
49
|
+
"luxon": "3.7.2",
|
|
50
|
+
"nock": "13.5.6",
|
|
51
|
+
"superstruct": "2.0.2",
|
|
52
|
+
"type-fest": "4.41.0",
|
|
53
|
+
"vitest": "4.0.16"
|
|
57
54
|
},
|
|
58
55
|
"devDependencies": {
|
|
59
|
-
"@diia-inhouse/configs": "
|
|
60
|
-
"@diia-inhouse/eslint-config": "
|
|
61
|
-
"@diia-inhouse/types": "
|
|
62
|
-
"@types/lodash": "4.17.
|
|
63
|
-
"@types/luxon": "3.
|
|
64
|
-
"bson": "6.
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"
|
|
56
|
+
"@diia-inhouse/configs": "6.1.1",
|
|
57
|
+
"@diia-inhouse/eslint-config": "8.4.0",
|
|
58
|
+
"@diia-inhouse/types": "11.4.1",
|
|
59
|
+
"@types/lodash": "4.17.21",
|
|
60
|
+
"@types/luxon": "3.7.1",
|
|
61
|
+
"bson": "6.10.4",
|
|
62
|
+
"drizzle-orm": "0.45.1",
|
|
63
|
+
"lockfile-lint": "4.14.1",
|
|
64
|
+
"madge": "8.0.0",
|
|
65
|
+
"mongoose": "8.20.4",
|
|
66
|
+
"rimraf": "6.1.2",
|
|
67
|
+
"typescript": "5.9.3"
|
|
70
68
|
},
|
|
71
69
|
"peerDependencies": {
|
|
72
|
-
"@diia-inhouse/types": ">=
|
|
70
|
+
"@diia-inhouse/types": ">=10.0.11",
|
|
73
71
|
"bson": ">=6.2.0",
|
|
72
|
+
"drizzle-orm": ">=0.38.2",
|
|
74
73
|
"mongoose": ">=8.0.0"
|
|
75
74
|
},
|
|
76
75
|
"peerDependenciesMeta": {
|
|
76
|
+
"drizzle-orm": {
|
|
77
|
+
"optional": true
|
|
78
|
+
},
|
|
77
79
|
"mongoose": {
|
|
78
80
|
"optional": true
|
|
79
81
|
}
|
|
@@ -81,15 +83,9 @@
|
|
|
81
83
|
"resolutions": {
|
|
82
84
|
"@babel/traverse": "7.25.9"
|
|
83
85
|
},
|
|
84
|
-
"jest": {
|
|
85
|
-
"preset": "@diia-inhouse/configs/dist/jest"
|
|
86
|
-
},
|
|
87
86
|
"commitlint": {
|
|
88
87
|
"extends": "@diia-inhouse/configs/dist/commitlint"
|
|
89
88
|
},
|
|
90
|
-
"eslintConfig": {
|
|
91
|
-
"extends": "@diia-inhouse/eslint-config"
|
|
92
|
-
},
|
|
93
89
|
"release": {
|
|
94
90
|
"extends": "@diia-inhouse/configs/dist/semantic-release/package",
|
|
95
91
|
"branches": [
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/* eslint-disable unicorn/filename-case */
|
|
2
|
+
import { expect } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import * as matchers from './matchers'
|
|
5
|
+
|
|
6
|
+
expect.extend(matchers)
|
|
7
|
+
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
9
|
+
export interface CustomMatchers<R = any> {
|
|
10
|
+
toInterceptorsBeDone(): R
|
|
11
|
+
|
|
12
|
+
toBeAttentionMessage(): R
|
|
13
|
+
|
|
14
|
+
toBeTextWithParameters(): R
|
|
15
|
+
|
|
16
|
+
toBeContextMenu(): R
|
|
17
|
+
|
|
18
|
+
toContainObjects<T>(argument: Partial<T>[]): R
|
|
19
|
+
|
|
20
|
+
toBeValueWithLabel(value?: string): R
|
|
21
|
+
|
|
22
|
+
toBeNavigationPanel(): R
|
|
23
|
+
|
|
24
|
+
toBeMainButton(action?: string): R
|
|
25
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Describe, enums, object, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { AmountAtm, AmountAtmColour } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { schemaBuilder } from '../utils'
|
|
6
|
+
|
|
7
|
+
const schema: Describe<AmountAtm> = object({
|
|
8
|
+
componentId: string(),
|
|
9
|
+
colour: enums(Object.values(AmountAtmColour)),
|
|
10
|
+
value: string(),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export const amountAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { ArticlePicAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { schemaBuilder } from '../utils'
|
|
6
|
+
|
|
7
|
+
const schema: Describe<ArticlePicAtm> = object({
|
|
8
|
+
componentId: optional(string()),
|
|
9
|
+
image: string(),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const articlePicAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Describe, number, object } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BadgeCounterAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { schemaBuilder } from '../utils'
|
|
6
|
+
|
|
7
|
+
const schema: Describe<BadgeCounterAtm> = object({
|
|
8
|
+
count: number(),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const badgeCounterAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnLinkAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnLinkAtm> = object({
|
|
10
|
+
label: string(),
|
|
11
|
+
state: optional(buttonStateSchema),
|
|
12
|
+
action: optional(buttonActionSchema()),
|
|
13
|
+
componentId: optional(string()),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const btnLinkAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnLoadPlainIconAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { iconSchema } from '../enums/icon'
|
|
7
|
+
import { schemaBuilder } from '../utils'
|
|
8
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
9
|
+
|
|
10
|
+
const schema: Describe<BtnLoadPlainIconAtm> = object({
|
|
11
|
+
componentId: optional(string()),
|
|
12
|
+
id: optional(string()),
|
|
13
|
+
label: string(),
|
|
14
|
+
state: optional(buttonStateSchema),
|
|
15
|
+
action: optional(buttonActionSchema()),
|
|
16
|
+
icon: iconSchema,
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
export const btnLoadPlainIconAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnPlainAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnPlainAtm> = object({
|
|
10
|
+
label: string(),
|
|
11
|
+
state: optional(buttonStateSchema),
|
|
12
|
+
action: optional(buttonActionSchema()),
|
|
13
|
+
componentId: string(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const btnPlainAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnPlainIconAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { iconSchema } from '../enums/icon'
|
|
7
|
+
import { schemaBuilder } from '../utils'
|
|
8
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
9
|
+
|
|
10
|
+
const schema: Describe<BtnPlainIconAtm> = object({
|
|
11
|
+
label: string(),
|
|
12
|
+
state: optional(buttonStateSchema),
|
|
13
|
+
action: optional(buttonActionSchema()),
|
|
14
|
+
icon: iconSchema,
|
|
15
|
+
componentId: optional(string()),
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
export const btnPlainIconAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnPrimaryAdditionalAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnPrimaryAdditionalAtm> = object({
|
|
10
|
+
label: string(),
|
|
11
|
+
componentId: optional(string()),
|
|
12
|
+
state: optional(buttonStateSchema),
|
|
13
|
+
action: optional(buttonActionSchema()),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const btnPrimaryAdditionalAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Describe, array, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnPrimaryDefaultAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnPrimaryDefaultAtm> = object({
|
|
10
|
+
label: string(),
|
|
11
|
+
state: optional(buttonStateSchema),
|
|
12
|
+
actions: array(buttonActionSchema()),
|
|
13
|
+
action: optional(buttonActionSchema()),
|
|
14
|
+
componentId: optional(string()),
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
export const btnPrimaryDefaultAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnPrimaryLargeAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnPrimaryLargeAtm> = object({
|
|
10
|
+
componentId: optional(string()),
|
|
11
|
+
label: string(),
|
|
12
|
+
state: optional(buttonStateSchema),
|
|
13
|
+
action: optional(buttonActionSchema()),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const btnPrimaryLargeAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnPrimaryWideAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnPrimaryWideAtm> = object({
|
|
10
|
+
componentId: string(),
|
|
11
|
+
label: string(),
|
|
12
|
+
state: optional(buttonStateSchema),
|
|
13
|
+
action: optional(buttonActionSchema()),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const btnPrimaryWideAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Describe, object, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnSemiLightAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnSemiLightAtm> = object({
|
|
10
|
+
componentId: string(),
|
|
11
|
+
label: string(),
|
|
12
|
+
state: buttonStateSchema,
|
|
13
|
+
action: buttonActionSchema(),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const btnSemiLightAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnStrokeAdditionalAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnStrokeAdditionalAtm> = object({
|
|
10
|
+
label: string(),
|
|
11
|
+
componentId: optional(string()),
|
|
12
|
+
state: optional(buttonStateSchema),
|
|
13
|
+
action: optional(buttonActionSchema()),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const btnStrokeAdditionalAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnStrokeDefaultAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<BtnStrokeDefaultAtm> = object({
|
|
10
|
+
label: string(),
|
|
11
|
+
state: optional(buttonStateSchema),
|
|
12
|
+
action: optional(buttonActionSchema()),
|
|
13
|
+
componentId: optional(string()),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export const btnStrokeDefaultAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { BtnWhiteAdditionalIconAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { buttonStateSchema } from '../enums/button'
|
|
6
|
+
import { iconSchema } from '../enums/icon'
|
|
7
|
+
import { schemaBuilder } from '../utils'
|
|
8
|
+
import { badgeCounterAtmSchema } from './badgeCounterAtm'
|
|
9
|
+
import { buttonActionSchema } from './shared/buttonAction'
|
|
10
|
+
|
|
11
|
+
const schema: Describe<BtnWhiteAdditionalIconAtm> = object({
|
|
12
|
+
label: optional(string()),
|
|
13
|
+
componentId: optional(string()),
|
|
14
|
+
icon: iconSchema,
|
|
15
|
+
state: optional(buttonStateSchema),
|
|
16
|
+
action: optional(buttonActionSchema()),
|
|
17
|
+
badgeCounterAtm: optional(badgeCounterAtmSchema()),
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
export const btnWhiteAdditionalIconSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Describe, boolean, object, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { CalendarItemAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { schemaBuilder } from '../utils'
|
|
6
|
+
|
|
7
|
+
const schema: Describe<CalendarItemAtm> = object({
|
|
8
|
+
label: string(),
|
|
9
|
+
isActive: boolean(),
|
|
10
|
+
isSelected: boolean(),
|
|
11
|
+
isToday: boolean(),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const calendarItemAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Describe, enums, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { ChipStatusAtm, ChipStatusAtmType } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { schemaBuilder } from '../utils'
|
|
6
|
+
|
|
7
|
+
const schema: Describe<ChipStatusAtm> = object({
|
|
8
|
+
componentId: optional(string()),
|
|
9
|
+
code: string(),
|
|
10
|
+
name: string(),
|
|
11
|
+
type: enums(Object.values(ChipStatusAtmType)),
|
|
12
|
+
})
|
|
13
|
+
|
|
14
|
+
export const chipStatusAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Describe, number, object } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { DotNavigationAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { schemaBuilder } from '../utils'
|
|
6
|
+
|
|
7
|
+
const schema: Describe<DotNavigationAtm> = object({
|
|
8
|
+
count: number(),
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const dotNavigationAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { DoubleIconAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { iconSchema } from '../enums/icon'
|
|
6
|
+
import { schemaBuilder } from '../utils'
|
|
7
|
+
import { iconActionSchema } from './shared/iconAction'
|
|
8
|
+
|
|
9
|
+
const schema: Describe<DoubleIconAtm> = object({
|
|
10
|
+
accessibilityDescription: optional(string()),
|
|
11
|
+
code: iconSchema,
|
|
12
|
+
action: iconActionSchema(),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const doubleIconAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Describe, object, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { GreyTitleAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { schemaBuilder } from '../utils'
|
|
6
|
+
|
|
7
|
+
const schema: Describe<GreyTitleAtm> = object({
|
|
8
|
+
componentId: string(),
|
|
9
|
+
label: string(),
|
|
10
|
+
})
|
|
11
|
+
|
|
12
|
+
export const greyTitleAtmSchema = schemaBuilder(schema)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
2
|
+
|
|
3
|
+
import { IconAtm } from '@diia-inhouse/types'
|
|
4
|
+
|
|
5
|
+
import { iconActionSchema } from './shared/iconAction'
|
|
6
|
+
|
|
7
|
+
export const iconAtmSchema: Describe<IconAtm> = object({
|
|
8
|
+
componentId: optional(string()),
|
|
9
|
+
code: string(),
|
|
10
|
+
accessibilityDescription: optional(string()),
|
|
11
|
+
action: optional(iconActionSchema()),
|
|
12
|
+
})
|