mirror of
https://github.com/Unleash/unleash.git
synced 2024-11-01 19:07:38 +01:00
ab75d4085e
* refactor: add schemas to user admin controller * refactor: remove unused SessionService * refactor: fix search query type confusion * refactor: add schemas to user controller (#1693) * refactor: add schemas to user controller * refactor: fix getAllUserSplashes method name * refactor: name and email should not be required on create * refactor: only some user fields may be updated * refactor: should not require any fields on user update (#1730) * refactor: send 400 instead of 500 on missing username and email * refactor: should not require any fields for user update * refactor: note that earlier versions required name or email * refactor: merge roleDescriptionSchema and roleSchema
38 lines
954 B
TypeScript
38 lines
954 B
TypeScript
import { validateSchema } from '../validate';
|
|
import { MeSchema } from './me-schema';
|
|
|
|
test('meSchema', () => {
|
|
const data: MeSchema = {
|
|
user: { id: 1 },
|
|
permissions: [{ permission: 'a' }],
|
|
feedback: [{ userId: 1, feedbackId: 'a', neverShow: false }],
|
|
splash: { a: true },
|
|
};
|
|
|
|
expect(
|
|
validateSchema('#/components/schemas/meSchema', data),
|
|
).toBeUndefined();
|
|
});
|
|
|
|
test('meSchema empty', () => {
|
|
expect(
|
|
validateSchema('#/components/schemas/meSchema', {}),
|
|
).toMatchSnapshot();
|
|
});
|
|
|
|
test('meSchema missing permissions', () => {
|
|
expect(
|
|
validateSchema('#/components/schemas/meSchema', { user: { id: 1 } }),
|
|
).toMatchSnapshot();
|
|
});
|
|
|
|
test('meSchema missing splash', () => {
|
|
expect(
|
|
validateSchema('#/components/schemas/meSchema', {
|
|
user: { id: 1 },
|
|
permissions: [],
|
|
feedback: [],
|
|
}),
|
|
).toMatchSnapshot();
|
|
});
|