Skip to content

Commit

Permalink
Removing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
kc13greiner committed Jun 20, 2024
1 parent d468deb commit b7f1de0
Showing 1 changed file with 1 addition and 64 deletions.
65 changes: 1 addition & 64 deletions x-pack/plugins/security/server/fips/fips_service.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { BehaviorSubject, of } from 'rxjs';

import { loggingSystemMock } from '@kbn/core/server/mocks';
import type { LicenseType } from '@kbn/licensing-plugin/common/types';
import type { SecurityLicense, SecurityLicenseFeatures } from '@kbn/security-plugin-types-common';
import type { SecurityLicenseFeatures } from '@kbn/security-plugin-types-common';

import type { FipsServiceSetupInternal, FipsServiceSetupParams } from './fips_service';
import { FipsService } from './fips_service';
Expand Down Expand Up @@ -75,75 +75,12 @@ describe('FipsService', () => {

expect(fipsServiceSetup).toMatchInlineSnapshot(`
Object {
"isKibanaFipsModeEnabled": [Function],
"validateLicenseForFips": [Function],
}
`);
});
});

describe('#isKibanaFipsModeEnabled', () => {
let license: SecurityLicense;
beforeEach(() => {
license = licenseMock.create(of({ allowFips: true }), 'platinum');

fipsService = new FipsService(logger);
});

it('should return `true` when config `xpack.security.experimental.fipsMode.enabled` is `true`', () => {
mockGetFipsFn.mockImplementationOnce(() => {
return 1;
});

fipsServiceSetup = fipsService.setup({
license,
config: createConfig(
ConfigSchema.validate({ experimental: { fipsMode: { enabled: true } } }),
loggingSystemMock.createLogger(),
{
isTLSEnabled: false,
}
),
});

expect(fipsServiceSetup.isKibanaFipsModeEnabled()).toBe(true);
});

it('should return `false` when config `xpack.security.experimental.fipsMode.enabled` is `false`', () => {
mockGetFipsFn.mockImplementationOnce(() => {
return 0;
});

fipsServiceSetup = fipsService.setup({
license,
config: createConfig(
ConfigSchema.validate({ experimental: { fipsMode: { enabled: false } } }),
loggingSystemMock.createLogger(),
{
isTLSEnabled: false,
}
),
});

expect(fipsServiceSetup.isKibanaFipsModeEnabled()).toBe(false);
});

it('should return `false` when config `xpack.security.experimental.fipsMode.enabled` is `undefined`', () => {
mockGetFipsFn.mockImplementationOnce(() => {
return 0;
});

fipsServiceSetup = fipsService.setup({
license,
config: createConfig(ConfigSchema.validate({}), loggingSystemMock.createLogger(), {
isTLSEnabled: false,
}),
});

expect(fipsServiceSetup.isKibanaFipsModeEnabled()).toBe(false);
});
});

describe('#validateLicenseForFips', () => {
describe('start-up check', () => {
it('should not throw Error/log.error if license features allowFips and `experimental.fipsMode.enabled` is `false`', () => {
Expand Down

0 comments on commit b7f1de0

Please sign in to comment.