mirror of
https://github.com/standardnotes/server
synced 2026-07-30 20:16:37 -04:00
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import 'reflect-metadata'
|
|
|
|
import { SubscriptionSetting } from '../Domain/Setting/SubscriptionSetting'
|
|
|
|
import { SubscriptionSettingProjector } from './SubscriptionSettingProjector'
|
|
|
|
describe('SubscriptionSettingProjector', () => {
|
|
let setting: SubscriptionSetting
|
|
|
|
const createProjector = () => new SubscriptionSettingProjector()
|
|
|
|
beforeEach(() => {
|
|
setting = {
|
|
uuid: 'setting-uuid',
|
|
name: 'setting-name',
|
|
value: 'setting-value',
|
|
serverEncryptionVersion: 1,
|
|
createdAt: 1,
|
|
updatedAt: 2,
|
|
sensitive: false,
|
|
} as jest.Mocked<SubscriptionSetting>
|
|
})
|
|
|
|
it('should create a simple projection of a setting', async () => {
|
|
const projection = await createProjector().projectSimple(setting)
|
|
expect(projection).toStrictEqual({
|
|
uuid: 'setting-uuid',
|
|
name: 'setting-name',
|
|
value: 'setting-value',
|
|
createdAt: 1,
|
|
updatedAt: 2,
|
|
sensitive: false,
|
|
})
|
|
})
|
|
it('should create a simple projection of list of settings', async () => {
|
|
const projection = await createProjector().projectManySimple([setting])
|
|
expect(projection).toStrictEqual([
|
|
{
|
|
uuid: 'setting-uuid',
|
|
name: 'setting-name',
|
|
value: 'setting-value',
|
|
createdAt: 1,
|
|
updatedAt: 2,
|
|
sensitive: false,
|
|
},
|
|
])
|
|
})
|
|
})
|