@diia-inhouse/test 6.6.4 → 7.2.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,21 @@
|
|
|
1
|
+
export { toBeAttentionMessageParameter } from './toBeAttentionMessageParameter'
|
|
2
|
+
|
|
3
|
+
export { toBeAttentionMessage } from './toBeAttentionMessage'
|
|
4
|
+
|
|
5
|
+
export { toBeTextWithParameters } from './toBeTextWithParameters'
|
|
6
|
+
|
|
7
|
+
export { toBeContextMenu } from './toBeContextMenu'
|
|
8
|
+
|
|
9
|
+
export { toInterceptorsBeDone } from './toInterceptorsBeDone'
|
|
10
|
+
|
|
11
|
+
export { toContainObjects } from './toContainObjects'
|
|
12
|
+
|
|
13
|
+
export { toBeValueWithLabel } from './toBeValueWithLabel'
|
|
14
|
+
|
|
15
|
+
export { toBeNavigationPanel } from './toBeNavigationPanel'
|
|
16
|
+
|
|
17
|
+
export { toBeMainButton } from './toBeMainButton'
|
|
18
|
+
|
|
19
|
+
export { toEqual } from './toEqual'
|
|
20
|
+
|
|
21
|
+
export { toBe } from './toBe'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { ExpectationResult, MatcherState } from '@vitest/expect'
|
|
2
|
+
|
|
3
|
+
import { cleanForDiff, cleanUndefined } from '../utils'
|
|
4
|
+
|
|
5
|
+
export function toBe(this: MatcherState, received: unknown, expected: unknown): ExpectationResult {
|
|
6
|
+
if (typeof received !== 'object' || received === null || typeof expected !== 'object' || expected === null) {
|
|
7
|
+
const pass = Object.is(received, expected)
|
|
8
|
+
|
|
9
|
+
return {
|
|
10
|
+
pass,
|
|
11
|
+
message: () =>
|
|
12
|
+
pass
|
|
13
|
+
? `expected ${this.utils.printReceived(received)} not to be ${this.utils.printExpected(expected)}`
|
|
14
|
+
: `expected ${this.utils.printReceived(received)} to be ${this.utils.printExpected(expected)}`,
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const cleanedReceived = cleanUndefined(received)
|
|
19
|
+
const cleanedExpected = cleanUndefined(expected)
|
|
20
|
+
|
|
21
|
+
const pass = this.equals(cleanedReceived, cleanedExpected, this.customTesters)
|
|
22
|
+
|
|
23
|
+
if (pass) {
|
|
24
|
+
return {
|
|
25
|
+
pass: true,
|
|
26
|
+
message: () =>
|
|
27
|
+
`expected ${this.utils.printReceived(cleanedReceived)} not to deeply equal ${this.utils.printExpected(expected)}`,
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const diffExpected = cleanForDiff(expected, cleanedReceived)
|
|
32
|
+
const diff = this.utils.diff(diffExpected, cleanedReceived)
|
|
33
|
+
|
|
34
|
+
return {
|
|
35
|
+
pass: false,
|
|
36
|
+
message: () => `toBe diff:\n\n${diff}`,
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { Describe, array, object, optional, string } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
import { assert } from '../../utils'
|
|
5
|
+
import { AttentionMessageParameterSchema } from '../toBeAttentionMessageParameter'
|
|
6
|
+
import { AttentionMessage } from './interfaces'
|
|
7
|
+
|
|
8
|
+
const AttentionMessageSchema: Describe<AttentionMessage> = object({
|
|
9
|
+
icon: string(),
|
|
10
|
+
title: optional(string()),
|
|
11
|
+
text: optional(string()),
|
|
12
|
+
parameters: optional(array(AttentionMessageParameterSchema)),
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export function toBeAttentionMessage(received: AttentionMessage): ExpectationResult {
|
|
16
|
+
const title = 'AttentionMessage matcher'
|
|
17
|
+
|
|
18
|
+
return assert(title, received, AttentionMessageSchema)
|
|
19
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { Describe, object, string } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
import { AttentionMessageParameter } from '../interfaces'
|
|
5
|
+
import { assert } from '../utils'
|
|
6
|
+
|
|
7
|
+
export const AttentionMessageParameterSchema: Describe<AttentionMessageParameter> = object({
|
|
8
|
+
type: string(),
|
|
9
|
+
data: object({
|
|
10
|
+
name: string(),
|
|
11
|
+
alt: string(),
|
|
12
|
+
resource: string(),
|
|
13
|
+
}),
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
export function toBeAttentionMessageParameter(received: AttentionMessageParameter): ExpectationResult {
|
|
17
|
+
const message = `AttentionMessageParameter matcher`
|
|
18
|
+
|
|
19
|
+
return assert(message, received, AttentionMessageParameterSchema)
|
|
20
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { Describe, array, object, optional, record, string } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
import { assert } from '../../utils'
|
|
5
|
+
import { PublicServiceContextMenu } from './interfaces'
|
|
6
|
+
|
|
7
|
+
export const ContextMenuSchema: Describe<PublicServiceContextMenu[]> = array(
|
|
8
|
+
object({
|
|
9
|
+
type: string(),
|
|
10
|
+
name: string(),
|
|
11
|
+
code: optional(string()),
|
|
12
|
+
appVersions: optional(
|
|
13
|
+
object({
|
|
14
|
+
versions: optional(record(string(), array(string()))),
|
|
15
|
+
minVersion: optional(record(string(), string())),
|
|
16
|
+
}),
|
|
17
|
+
),
|
|
18
|
+
}),
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
export function toBeContextMenu(contextMenu: PublicServiceContextMenu[]): ExpectationResult {
|
|
22
|
+
const message = `PublicServiceContextMenu[] matcher`
|
|
23
|
+
|
|
24
|
+
return assert(message, contextMenu, ContextMenuSchema)
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { Struct } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
import { assert } from '../../utils'
|
|
5
|
+
|
|
6
|
+
export function toBeDesignSystemElement(received: unknown, schema: Struct<unknown, unknown>): ExpectationResult {
|
|
7
|
+
return assert('toBeDesignSystemElement matcher', received, schema)
|
|
8
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { array, literal, object, optional, string } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
import { assert } from '../../utils'
|
|
5
|
+
import { MainButton } from './interfaces'
|
|
6
|
+
|
|
7
|
+
export function toBeMainButton(received: MainButton, action?: string): ExpectationResult {
|
|
8
|
+
const message = `MainButton matcher`
|
|
9
|
+
|
|
10
|
+
return assert(
|
|
11
|
+
message,
|
|
12
|
+
received,
|
|
13
|
+
object({
|
|
14
|
+
name: string(),
|
|
15
|
+
action: action ? literal(action) : optional(string()),
|
|
16
|
+
checkboxes: optional(array(string())),
|
|
17
|
+
}),
|
|
18
|
+
)
|
|
19
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { Describe, object, optional, string } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
import { assert } from '../../utils'
|
|
5
|
+
import { ContextMenuSchema } from '../toBeContextMenu'
|
|
6
|
+
import { NavigationPanel } from './interfaces'
|
|
7
|
+
|
|
8
|
+
const NavigationPanelSchema: Describe<NavigationPanel> = object({
|
|
9
|
+
header: optional(string()),
|
|
10
|
+
contextMenu: optional(ContextMenuSchema),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export function toBeNavigationPanel(navigationPanel: NavigationPanel): ExpectationResult {
|
|
14
|
+
const message = `NavigationPanel matcher`
|
|
15
|
+
|
|
16
|
+
return assert(message, navigationPanel, NavigationPanelSchema)
|
|
17
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { Describe, array, object, optional, string } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
import { assert } from '../../utils'
|
|
5
|
+
import { AttentionMessageParameterSchema } from '../toBeAttentionMessageParameter'
|
|
6
|
+
import { TextWithParameters } from './interfaces'
|
|
7
|
+
|
|
8
|
+
const textWithParametersSchema: Describe<TextWithParameters> = object({
|
|
9
|
+
text: string(),
|
|
10
|
+
parameters: optional(array(AttentionMessageParameterSchema)),
|
|
11
|
+
})
|
|
12
|
+
|
|
13
|
+
export function toBeTextWithParameters(received: TextWithParameters): ExpectationResult {
|
|
14
|
+
const message = `TextWithParameters matcher`
|
|
15
|
+
|
|
16
|
+
return assert(message, received, textWithParametersSchema)
|
|
17
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { literal, object, string } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
import { assert } from '../../utils'
|
|
5
|
+
import { ValueWithLabel } from './interfaces'
|
|
6
|
+
|
|
7
|
+
export function toBeValueWithLabel(received: ValueWithLabel, value?: string): ExpectationResult {
|
|
8
|
+
const message = `ValueWithLabel matcher`
|
|
9
|
+
|
|
10
|
+
return assert(
|
|
11
|
+
message,
|
|
12
|
+
received,
|
|
13
|
+
object({
|
|
14
|
+
label: string(),
|
|
15
|
+
value: value ? literal(value) : string(),
|
|
16
|
+
}),
|
|
17
|
+
)
|
|
18
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { ExpectationResult, MatcherState } from '@vitest/expect'
|
|
2
|
+
import { expect } from 'vitest'
|
|
3
|
+
|
|
4
|
+
export function toContainObjects(this: MatcherState, received: unknown, argument: unknown[]): ExpectationResult {
|
|
5
|
+
const pass = this.equals(received, expect.arrayContaining(argument.map((item) => expect.objectContaining(item))))
|
|
6
|
+
if (pass) {
|
|
7
|
+
return {
|
|
8
|
+
message: () => `expected ${this.utils.printReceived(received)} not to contain objects ${this.utils.printExpected(argument)}`,
|
|
9
|
+
pass: true,
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return {
|
|
14
|
+
message: () => `expected ${this.utils.printReceived(received)} to contain objects ${this.utils.printExpected(argument)}`,
|
|
15
|
+
pass: false,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ExpectationResult, MatcherState } from '@vitest/expect'
|
|
2
|
+
|
|
3
|
+
import { cleanForDiff, cleanUndefined } from '../utils'
|
|
4
|
+
|
|
5
|
+
export function toEqual(this: MatcherState, received: unknown, expected: unknown): ExpectationResult {
|
|
6
|
+
const cleanedReceived = cleanUndefined(received)
|
|
7
|
+
const cleanedExpected = cleanUndefined(expected)
|
|
8
|
+
|
|
9
|
+
const pass = this.equals(cleanedReceived, cleanedExpected, this.customTesters)
|
|
10
|
+
|
|
11
|
+
if (pass) {
|
|
12
|
+
return {
|
|
13
|
+
pass: true,
|
|
14
|
+
message: () =>
|
|
15
|
+
`expected ${this.utils.printReceived(cleanedReceived)} not to deeply equal ${this.utils.printExpected(expected)}`,
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const diffExpected = cleanForDiff(expected, cleanedReceived)
|
|
20
|
+
const diff = this.utils.diff(diffExpected, cleanedReceived)
|
|
21
|
+
|
|
22
|
+
return {
|
|
23
|
+
pass: false,
|
|
24
|
+
message: () => `toEqual diff:\n\n${diff}`,
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { Scope } from 'nock'
|
|
3
|
+
|
|
4
|
+
export function toInterceptorsBeDone(scope: Scope): ExpectationResult {
|
|
5
|
+
const message = 'expected nock interceptors to be done'
|
|
6
|
+
|
|
7
|
+
if (scope?.isDone()) {
|
|
8
|
+
return {
|
|
9
|
+
message: () => message,
|
|
10
|
+
pass: true,
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
return {
|
|
15
|
+
message: () => `${message}. Pending interceptors:\n${scope?.pendingMocks().join('\n')}`,
|
|
16
|
+
pass: false,
|
|
17
|
+
}
|
|
18
|
+
}
|
package/vitest/utils.ts
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
import type { AsymmetricMatcherInterface, ExpectationResult } from '@vitest/expect'
|
|
2
|
+
import { Struct, StructError, assert as superstructAssert } from 'superstruct'
|
|
3
|
+
|
|
4
|
+
function isAsymmetricMatcher(obj: unknown): obj is AsymmetricMatcherInterface {
|
|
5
|
+
if (obj === null || typeof obj !== 'object') {
|
|
6
|
+
return false
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
return typeof (obj as AsymmetricMatcherInterface).asymmetricMatch === 'function'
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function isPlainObject(obj: unknown): obj is Record<string, unknown> {
|
|
13
|
+
if (obj === null || typeof obj !== 'object') {
|
|
14
|
+
return false
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
const proto = Object.getPrototypeOf(obj)
|
|
18
|
+
|
|
19
|
+
return proto === null || proto === Object.prototype
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* Removes undefined fields from an object.
|
|
24
|
+
*/
|
|
25
|
+
export function cleanUndefined<T>(obj: T): T {
|
|
26
|
+
if (obj === null || obj === undefined) {
|
|
27
|
+
return obj
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
if (Array.isArray(obj)) {
|
|
31
|
+
return obj.map((item) => cleanUndefined(item)) as T
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (typeof obj === 'object') {
|
|
35
|
+
if (isAsymmetricMatcher(obj) || !isPlainObject(obj)) {
|
|
36
|
+
return obj
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const result: Record<string, unknown> = {}
|
|
40
|
+
|
|
41
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
42
|
+
if (value !== undefined) {
|
|
43
|
+
result[key] = cleanUndefined(value)
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return result as T
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
return obj
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* Cleans expected object for diff display.
|
|
55
|
+
* Replaces asymmetric matchers with actual received values where they match.
|
|
56
|
+
*/
|
|
57
|
+
export function cleanForDiff<T>(expected: T, received: T): T {
|
|
58
|
+
if (expected === null || expected === undefined) {
|
|
59
|
+
return expected
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
if (Array.isArray(expected)) {
|
|
63
|
+
const receivedArr = Array.isArray(received) ? received : []
|
|
64
|
+
|
|
65
|
+
return expected.map((item, i) => cleanForDiff(item, receivedArr[i])) as T
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
if (typeof expected === 'object') {
|
|
69
|
+
if (isAsymmetricMatcher(expected)) {
|
|
70
|
+
if (expected.asymmetricMatch(received)) {
|
|
71
|
+
return received
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
return expected
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (!isPlainObject(expected)) {
|
|
78
|
+
return expected
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const result: Record<string, unknown> = {}
|
|
82
|
+
const receivedObj = (typeof received === 'object' && received !== null ? received : {}) as Record<string, unknown>
|
|
83
|
+
|
|
84
|
+
for (const [key, value] of Object.entries(expected)) {
|
|
85
|
+
if (value !== undefined) {
|
|
86
|
+
result[key] = cleanForDiff(value, receivedObj[key])
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return result as T
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return expected
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function getPrettyMessage(data: unknown): string {
|
|
97
|
+
return JSON.stringify(data, null, 2)
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
101
|
+
export function assert(matcherMessage: string, data: unknown, schema: Struct<any>): ExpectationResult {
|
|
102
|
+
try {
|
|
103
|
+
superstructAssert(data, schema)
|
|
104
|
+
|
|
105
|
+
return {
|
|
106
|
+
pass: true,
|
|
107
|
+
message: () => `${matcherMessage} is satisfied`,
|
|
108
|
+
}
|
|
109
|
+
} catch (err) {
|
|
110
|
+
if (err instanceof StructError) {
|
|
111
|
+
const errors = []
|
|
112
|
+
|
|
113
|
+
for (const failure of err.failures()) {
|
|
114
|
+
const { message, value, type, path, branch } = failure
|
|
115
|
+
|
|
116
|
+
const errorItem = {
|
|
117
|
+
message,
|
|
118
|
+
value,
|
|
119
|
+
expectedType: type,
|
|
120
|
+
path,
|
|
121
|
+
branch,
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
errors.push(errorItem)
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const errorMessage = {
|
|
128
|
+
matcherMessage,
|
|
129
|
+
receivedData: data,
|
|
130
|
+
errors,
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
return {
|
|
134
|
+
pass: false,
|
|
135
|
+
message: () => getPrettyMessage(errorMessage),
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
return {
|
|
140
|
+
pass: false,
|
|
141
|
+
message: () => `${matcherMessage}: Unexpected error caused. ${getPrettyMessage(err)}`,
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
}
|
package/dist/mock.js
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mockInstance = exports.mockAnyClass = exports.mockClass = void 0;
|
|
4
|
-
const jest_mock_1 = require("jest-mock");
|
|
5
|
-
/**
|
|
6
|
-
* @deprecated
|
|
7
|
-
* This function is not compatible with Vitest.
|
|
8
|
-
* For Vitest compatibility, please use the 'vitest-mock-extended' package instead.
|
|
9
|
-
*/
|
|
10
|
-
function mockClass(classToMock) {
|
|
11
|
-
const mocker = new jest_mock_1.ModuleMocker(global);
|
|
12
|
-
const metadata = mocker.getMetadata(classToMock);
|
|
13
|
-
if (!metadata) {
|
|
14
|
-
throw new Error(`Cannot find metadata to mock ${classToMock.name}`);
|
|
15
|
-
}
|
|
16
|
-
return mocker.generateFromMetadata(metadata);
|
|
17
|
-
}
|
|
18
|
-
exports.mockClass = mockClass;
|
|
19
|
-
/**
|
|
20
|
-
* @deprecated
|
|
21
|
-
* This function is not compatible with Vitest.
|
|
22
|
-
* For Vitest compatibility, please use the 'vitest-mock-extended' package instead.
|
|
23
|
-
*/
|
|
24
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
-
function mockAnyClass(classToMock) {
|
|
26
|
-
return mockClass(classToMock);
|
|
27
|
-
}
|
|
28
|
-
exports.mockAnyClass = mockAnyClass;
|
|
29
|
-
/**
|
|
30
|
-
* @deprecated
|
|
31
|
-
* This function is not compatible with Vitest.
|
|
32
|
-
* For Vitest compatibility, please use the 'vitest-mock-extended' package instead.
|
|
33
|
-
*/
|
|
34
|
-
function mockInstance(classToMock, props = {}) {
|
|
35
|
-
const mockedClass = mockClass(classToMock);
|
|
36
|
-
const mockedInstance = new mockedClass();
|
|
37
|
-
const keys = Object.keys(props);
|
|
38
|
-
for (const key of keys) {
|
|
39
|
-
Object.defineProperty(mockedInstance, key, { value: props[key] });
|
|
40
|
-
}
|
|
41
|
-
return mockedInstance;
|
|
42
|
-
}
|
|
43
|
-
exports.mockInstance = mockInstance;
|
|
44
|
-
//# sourceMappingURL=mock.js.map
|
package/dist/mock.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mock.js","sourceRoot":"","sources":["../src/mock.ts"],"names":[],"mappings":";;;AAAA,yCAAmD;AAEnD;;;;GAIG;AACH,SAAgB,SAAS,CAAsB,WAAc;IACzD,MAAM,MAAM,GAAG,IAAI,wBAAY,CAAC,MAAM,CAAC,CAAA;IAEvC,MAAM,QAAQ,GAAG,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAA;IAChD,IAAI,CAAC,QAAQ,EAAE,CAAC;QACZ,MAAM,IAAI,KAAK,CAAC,gCAAgC,WAAW,CAAC,IAAI,EAAE,CAAC,CAAA;IACvE,CAAC;IAED,OAA4B,MAAM,CAAC,oBAAoB,CAAI,QAAQ,CAAC,CAAA;AACxE,CAAC;AATD,8BASC;AAED;;;;GAIG;AACH,8DAA8D;AAC9D,SAAgB,YAAY,CAAsB,WAAc;IAC5D,OAAO,SAAS,CAAC,WAAW,CAAC,CAAA;AACjC,CAAC;AAFD,oCAEC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CACxB,WAAc,EACd,QAAyD,EAAE;IAE3D,MAAM,WAAW,GAAG,SAAS,CAAC,WAAW,CAAC,CAAA;IAC1C,MAAM,cAAc,GAAG,IAAI,WAAW,EAAE,CAAA;IAExC,MAAM,IAAI,GAAgB,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAA;IAE5C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACrB,MAAM,CAAC,cAAc,CAAC,cAAc,EAAE,GAAG,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,CAAA;IACrE,CAAC;IAED,OAAO,cAAc,CAAA;AACzB,CAAC;AAdD,oCAcC"}
|
package/dist/mongooseMock.js
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
const mongoose = __importStar(require("mongoose"));
|
|
27
|
-
class MongooseMock {
|
|
28
|
-
setResult(operation, result, repeat = 1) {
|
|
29
|
-
for (let i = 0; i < repeat; i++) {
|
|
30
|
-
jest.spyOn(mongoose.Query.prototype, operation).mockReturnValueOnce(result);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
setResultChain(operations, result, repeat = 1) {
|
|
34
|
-
for (let i = 0; i < repeat; i++) {
|
|
35
|
-
for (const operation of operations) {
|
|
36
|
-
jest.spyOn(mongoose.Query.prototype, operation).mockReturnThis();
|
|
37
|
-
}
|
|
38
|
-
jest.spyOn(mongoose.Query.prototype, 'exec').mockResolvedValueOnce(result);
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
exports.default = MongooseMock;
|
|
43
|
-
//# sourceMappingURL=mongooseMock.js.map
|
package/dist/mongooseMock.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"mongooseMock.js","sourceRoot":"","sources":["../src/mongooseMock.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,mDAAoC;AAIpC,MAAqB,YAAY;IAC7B,SAAS,CAAC,SAA+B,EAAE,MAAe,EAAE,MAAM,GAAG,CAAC;QAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAA;QAC/E,CAAC;IACL,CAAC;IAED,cAAc,CAAC,UAAkC,EAAE,MAAe,EAAE,MAAM,GAAG,CAAC;QAC1E,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;YAC9B,KAAK,MAAM,SAAS,IAAI,UAAU,EAAE,CAAC;gBACjC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC,cAAc,EAAE,CAAA;YACpE,CAAC;YAED,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,SAAS,EAAE,MAAM,CAAC,CAAC,qBAAqB,CAAC,MAAM,CAAC,CAAA;QAC9E,CAAC;IACL,CAAC;CACJ;AAhBD,+BAgBC"}
|
package/dist/types/mock.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
import { ClassLike } from 'jest-mock';
|
|
3
|
-
/**
|
|
4
|
-
* @deprecated
|
|
5
|
-
* This function is not compatible with Vitest.
|
|
6
|
-
* For Vitest compatibility, please use the 'vitest-mock-extended' package instead.
|
|
7
|
-
*/
|
|
8
|
-
export declare function mockClass<T extends ClassLike>(classToMock: T): jest.MockedClass<T>;
|
|
9
|
-
/**
|
|
10
|
-
* @deprecated
|
|
11
|
-
* This function is not compatible with Vitest.
|
|
12
|
-
* For Vitest compatibility, please use the 'vitest-mock-extended' package instead.
|
|
13
|
-
*/
|
|
14
|
-
export declare function mockAnyClass<T extends ClassLike>(classToMock: T): jest.MockedClass<any>;
|
|
15
|
-
/**
|
|
16
|
-
* @deprecated
|
|
17
|
-
* This function is not compatible with Vitest.
|
|
18
|
-
* For Vitest compatibility, please use the 'vitest-mock-extended' package instead.
|
|
19
|
-
*/
|
|
20
|
-
export declare function mockInstance<T extends ClassLike>(classToMock: T, props?: Partial<Record<keyof InstanceType<T>, unknown>>): InstanceType<T>;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
/// <reference types="jest" />
|
|
2
|
-
/// <reference types="mongoose/types/aggregate" />
|
|
3
|
-
/// <reference types="mongoose/types/callback" />
|
|
4
|
-
/// <reference types="mongoose/types/collection" />
|
|
5
|
-
/// <reference types="mongoose/types/connection" />
|
|
6
|
-
/// <reference types="mongoose/types/cursor" />
|
|
7
|
-
/// <reference types="mongoose/types/document" />
|
|
8
|
-
/// <reference types="mongoose/types/error" />
|
|
9
|
-
/// <reference types="mongoose/types/expressions" />
|
|
10
|
-
/// <reference types="mongoose/types/helpers" />
|
|
11
|
-
/// <reference types="mongoose/types/middlewares" />
|
|
12
|
-
/// <reference types="mongoose/types/indexes" />
|
|
13
|
-
/// <reference types="mongoose/types/models" />
|
|
14
|
-
/// <reference types="mongoose/types/mongooseoptions" />
|
|
15
|
-
/// <reference types="mongoose/types/pipelinestage" />
|
|
16
|
-
/// <reference types="mongoose/types/populate" />
|
|
17
|
-
/// <reference types="mongoose/types/query" />
|
|
18
|
-
/// <reference types="mongoose/types/schemaoptions" />
|
|
19
|
-
/// <reference types="mongoose/types/schematypes" />
|
|
20
|
-
/// <reference types="mongoose/types/session" />
|
|
21
|
-
/// <reference types="mongoose/types/types" />
|
|
22
|
-
/// <reference types="mongoose/types/utility" />
|
|
23
|
-
/// <reference types="mongoose/types/validation" />
|
|
24
|
-
/// <reference types="mongoose/types/virtuals" />
|
|
25
|
-
/// <reference types="mongoose/types/inferschematype" />
|
|
26
|
-
/// <reference types="mongoose/types/inferrawdoctype" />
|
|
27
|
-
import * as mongoose from 'mongoose';
|
|
28
|
-
type MockedQueryOperation = jest.FunctionPropertyNames<mongoose.Query<unknown, unknown>>;
|
|
29
|
-
export default class MongooseMock {
|
|
30
|
-
setResult(operation: MockedQueryOperation, result: unknown, repeat?: number): void;
|
|
31
|
-
setResultChain(operations: MockedQueryOperation[], result: unknown, repeat?: number): void;
|
|
32
|
-
}
|
|
33
|
-
export {};
|