Skip to content

Commit

Permalink
Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
elena-shostak committed Jan 6, 2025
1 parent f0d69d6 commit b682613
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -542,22 +542,19 @@ describe('Versioned route', () => {
authz: {
requiredPrivileges: ['foo', 'bar', 'baz'],
},
authc: undefined,
};
const securityConfig1: RouteSecurity = {
authz: {
requiredPrivileges: ['foo'],
},
authc: {
enabled: 'optional',
},
authc: undefined,
};
const securityConfig2: RouteSecurity = {
authz: {
requiredPrivileges: ['foo', 'bar'],
},
authc: {
enabled: true,
},
authc: undefined,
};
const versionedRoute = versionedRouter
.get({ path: '/test/{id}', access: 'internal', security: securityConfigDefault })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
*/

import { Type } from '@kbn/config-schema';
import type { RequestHandler, RouteConfig } from '@kbn/core/server';
import { kibanaResponseFactory } from '@kbn/core/server';
import type { AuthzDisabled, RequestHandler, RouteConfig } from '@kbn/core/server';
import { coreMock, httpServerMock } from '@kbn/core/server/mocks';
import type { DeeplyMockedKeys } from '@kbn/utility-types-jest';

Expand Down Expand Up @@ -65,9 +65,11 @@ describe('Common authentication routes', () => {
});

it('correctly defines route.', async () => {
expect(routeConfig.security?.authc?.enabled).toEqual(false);
expect((routeConfig.security?.authz as AuthzDisabled).enabled).toEqual(false);

expect(routeConfig.options).toEqual({
access: 'public',
authRequired: false,
tags: [ROUTE_TAG_CAN_REDIRECT, ROUTE_TAG_AUTH_FLOW],
excludeFromOAS: true,
});
Expand Down Expand Up @@ -201,7 +203,9 @@ describe('Common authentication routes', () => {
});

it('correctly defines route.', () => {
expect(routeConfig.options).toEqual({ authRequired: false });
expect(routeConfig.security?.authc?.enabled).toEqual(false);
expect((routeConfig.security?.authz as AuthzDisabled).enabled).toEqual(false);

expect(routeConfig.validate).toEqual({
body: expect.any(Type),
query: undefined,
Expand Down

0 comments on commit b682613

Please sign in to comment.