add initial test for search plugin

Signed-off-by: Emma Indal <emma.indahl@gmail.com>
This commit is contained in:
Emma Indal
2023-03-07 09:22:22 +01:00
committed by Camila Belo
parent 6422b85d46
commit 1473dd9eb6
3 changed files with 33 additions and 0 deletions
+1
View File
@@ -57,6 +57,7 @@
"zod": "~3.18.0"
},
"devDependencies": {
"@backstage/backend-test-utils": "workspace:^",
"@backstage/cli": "workspace:^",
"@types/supertest": "^2.0.8",
"supertest": "^6.1.3"
+31
View File
@@ -0,0 +1,31 @@
/*
* Copyright 2023 The Backstage Authors
*
* Licensed 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 { startTestBackend } from '@backstage/backend-test-utils';
import request from 'supertest';
import { searchPlugin } from './alpha';
describe('searchPlugin', () => {
it('should serve search results on query endpoint', async () => {
const { server } = await startTestBackend({
features: [searchPlugin()],
});
const response = await request(server).get('/api/search/query');
expect(response.status).toBe(200);
expect(response.body).toEqual({ numberOfResults: 0, results: [] });
});
});