-
Notifications
You must be signed in to change notification settings - Fork 8.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make defaultRoute accessible in NP Config (#52308)
* defaultRoute was not provided to the NP * improve defaultRoute validation * add test that defaultRoute is read from config * update tests
- Loading branch information
Showing
5 changed files
with
66 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 2 additions & 0 deletions
2
src/core/server/legacy/config/__snapshots__/legacy_object_to_config_adapter.test.ts.snap
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
src/legacy/server/http/integration_tests/default_route_provider_config.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
/* | ||
* Licensed to Elasticsearch B.V. under one or more contributor | ||
* license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright | ||
* ownership. Elasticsearch B.V. licenses this file to you under | ||
* the Apache License, Version 2.0 (the "License"); you may | ||
* not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
import * as kbnTestServer from '../../../../test_utils/kbn_server'; | ||
// eslint-disable-next-line @kbn/eslint/no-restricted-paths | ||
import { Root } from '../../../../core/server/root'; | ||
|
||
describe('default route provider', () => { | ||
let root: Root; | ||
|
||
afterEach(async () => await root.shutdown()); | ||
|
||
it('redirects to the configured default route', async function() { | ||
root = kbnTestServer.createRoot({ | ||
server: { | ||
defaultRoute: '/app/some/default/route', | ||
}, | ||
}); | ||
|
||
await root.setup(); | ||
await root.start(); | ||
|
||
const kbnServer = kbnTestServer.getKbnServer(root); | ||
|
||
kbnServer.server.decorate('request', 'getSavedObjectsClient', function() { | ||
return { | ||
get: (type: string, id: string) => ({ attributes: {} }), | ||
}; | ||
}); | ||
|
||
const { status, header } = await kbnTestServer.request.get(root, '/'); | ||
|
||
expect(status).toEqual(302); | ||
expect(header).toMatchObject({ | ||
location: '/app/some/default/route', | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters