mirror of
https://github.com/standardnotes/server
synced 2026-09-21 06:13:09 -04:00
fix: expected value for unit test (#417)
This commit is contained in:
@@ -2862,7 +2862,7 @@ const RAW_RUNTIME_STATE =
|
||||
"packageLocation": "./packages/domain-events/",\
|
||||
"packageDependencies": [\
|
||||
["@standardnotes/domain-events", "workspace:packages/domain-events"],\
|
||||
["@standardnotes/features", "npm:1.53.1"],\
|
||||
["@standardnotes/features", "npm:1.58.0"],\
|
||||
["@standardnotes/predicates", "workspace:packages/predicates"],\
|
||||
["@standardnotes/security", "workspace:packages/security"],\
|
||||
["@types/jest", "npm:29.1.1"],\
|
||||
|
||||
@@ -8,6 +8,27 @@ import { RoleToSubscriptionMapInterface } from '../Role/RoleToSubscriptionMapInt
|
||||
import { User } from '../User/User'
|
||||
import { UserSubscription } from '../Subscription/UserSubscription'
|
||||
|
||||
jest.mock('@standardnotes/features', () => {
|
||||
const original = jest.requireActual('@standardnotes/features')
|
||||
|
||||
return {
|
||||
...original,
|
||||
GetFeatures: jest.fn().mockImplementation(() => [
|
||||
{
|
||||
identifier: 'org.standardnotes.theme-autobiography',
|
||||
permission_name: original.PermissionName.AutobiographyTheme,
|
||||
expires_at: 555,
|
||||
},
|
||||
{
|
||||
identifier: 'org.standardnotes.bold-editor',
|
||||
permission_name: original.PermissionName.BoldEditor,
|
||||
expires_at: 777,
|
||||
},
|
||||
]),
|
||||
}
|
||||
})
|
||||
const { GetFeatures } = jest.requireMock('@standardnotes/features')
|
||||
|
||||
import { FeatureService } from './FeatureService'
|
||||
import { Permission, PermissionName } from '@standardnotes/features'
|
||||
import { OfflineUserSubscriptionRepositoryInterface } from '../Subscription/OfflineUserSubscriptionRepositoryInterface'
|
||||
@@ -303,6 +324,24 @@ describe('FeatureService', () => {
|
||||
name: PermissionName.FilesBeta,
|
||||
} as jest.Mocked<Permission>
|
||||
|
||||
GetFeatures.mockImplementation(() => [
|
||||
{
|
||||
identifier: 'org.standardnotes.theme-autobiography',
|
||||
permission_name: PermissionName.AutobiographyTheme,
|
||||
expires_at: 555,
|
||||
},
|
||||
{
|
||||
identifier: 'org.standardnotes.bold-editor',
|
||||
permission_name: PermissionName.BoldEditor,
|
||||
expires_at: 777,
|
||||
},
|
||||
{
|
||||
permission_name: PermissionName.FilesBeta,
|
||||
expires_at: undefined,
|
||||
no_expire: true,
|
||||
},
|
||||
])
|
||||
|
||||
const nonSubscriptionRole = {
|
||||
name: RoleName.NAMES.FilesBetaUser,
|
||||
uuid: 'role-files-beta',
|
||||
@@ -333,7 +372,6 @@ describe('FeatureService', () => {
|
||||
expires_at: 777,
|
||||
}),
|
||||
expect.objectContaining({
|
||||
identifier: 'org.standardnotes.files-beta',
|
||||
expires_at: undefined,
|
||||
no_expire: true,
|
||||
}),
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
"test": "jest spec --coverage --passWithNoTests"
|
||||
},
|
||||
"dependencies": {
|
||||
"@standardnotes/features": "^1.52.1",
|
||||
"@standardnotes/features": "^1.58.0",
|
||||
"@standardnotes/predicates": "workspace:*",
|
||||
"@standardnotes/security": "workspace:*"
|
||||
},
|
||||
|
||||
@@ -2116,7 +2116,7 @@ __metadata:
|
||||
version: 0.0.0-use.local
|
||||
resolution: "@standardnotes/domain-events@workspace:packages/domain-events"
|
||||
dependencies:
|
||||
"@standardnotes/features": "npm:^1.52.1"
|
||||
"@standardnotes/features": "npm:^1.58.0"
|
||||
"@standardnotes/predicates": "workspace:*"
|
||||
"@standardnotes/security": "workspace:*"
|
||||
"@types/jest": "npm:^29.1.1"
|
||||
@@ -2171,7 +2171,7 @@ __metadata:
|
||||
languageName: unknown
|
||||
linkType: soft
|
||||
|
||||
"@standardnotes/features@npm:1.53.1, @standardnotes/features@npm:^1.36.3, @standardnotes/features@npm:^1.52.1":
|
||||
"@standardnotes/features@npm:1.53.1, @standardnotes/features@npm:^1.36.3":
|
||||
version: 1.53.1
|
||||
resolution: "@standardnotes/features@npm:1.53.1"
|
||||
dependencies:
|
||||
|
||||
Reference in New Issue
Block a user