Rename variables containing XCMetrics* to Xcmetrics*
Signed-off-by: Niklas Granander <ngranander@spotify.com>
This commit is contained in:
@@ -16,13 +16,13 @@
|
||||
|
||||
import { DiscoveryApi } from '@backstage/core-plugin-api';
|
||||
import { ResponseError } from '@backstage/errors';
|
||||
import { BuildItem, BuildsResult, XCMetricsApi } from './types';
|
||||
import { BuildItem, BuildsResult, XcmetricsApi } from './types';
|
||||
|
||||
interface Options {
|
||||
discoveryApi: DiscoveryApi;
|
||||
}
|
||||
|
||||
export class XCMetricsClient implements XCMetricsApi {
|
||||
export class XcmetricsClient implements XcmetricsApi {
|
||||
private readonly discoveryApi: DiscoveryApi;
|
||||
|
||||
constructor(options: Options) {
|
||||
|
||||
@@ -15,4 +15,4 @@
|
||||
*/
|
||||
|
||||
export * from './types';
|
||||
export * from './XCMetricsClient';
|
||||
export * from './XcmetricsClient';
|
||||
|
||||
@@ -53,11 +53,11 @@ export type BuildsResult = {
|
||||
};
|
||||
};
|
||||
|
||||
export interface XCMetricsApi {
|
||||
export interface XcmetricsApi {
|
||||
getBuilds(): Promise<BuildItem[]>;
|
||||
}
|
||||
|
||||
export const xcmetricsApiRef = createApiRef<XCMetricsApi>({
|
||||
export const xcmetricsApiRef = createApiRef<XcmetricsApi>({
|
||||
id: 'plugin.xcmetrics.api',
|
||||
description: 'Used by the XCMetrics plugin to make requests',
|
||||
});
|
||||
|
||||
@@ -16,13 +16,13 @@
|
||||
import React from 'react';
|
||||
import { OverviewComponent } from './OverviewComponent';
|
||||
import { renderInTestApp } from '@backstage/test-utils';
|
||||
import { XCMetricsApi, xcmetricsApiRef } from '../../api';
|
||||
import { XcmetricsApi, xcmetricsApiRef } from '../../api';
|
||||
import { ApiProvider, ApiRegistry } from '@backstage/core-app-api';
|
||||
|
||||
describe('OverviewComponent', () => {
|
||||
it('should render', async () => {
|
||||
const mockUserId = 'mockUser';
|
||||
const mockApi: jest.Mocked<XCMetricsApi> = {
|
||||
const mockApi: jest.Mocked<XcmetricsApi> = {
|
||||
getBuilds: jest.fn().mockResolvedValue([
|
||||
{
|
||||
userid: mockUserId,
|
||||
@@ -47,7 +47,7 @@ describe('OverviewComponent', () => {
|
||||
});
|
||||
|
||||
it('should render an empty state when no builds exist', async () => {
|
||||
const mockApi: jest.Mocked<XCMetricsApi> = {
|
||||
const mockApi: jest.Mocked<XcmetricsApi> = {
|
||||
getBuilds: jest.fn().mockResolvedValue([]),
|
||||
};
|
||||
|
||||
@@ -61,7 +61,7 @@ describe('OverviewComponent', () => {
|
||||
|
||||
it('should show an error when API not responding', async () => {
|
||||
const errorMessage = 'MockErrorMessage';
|
||||
const mockApi: jest.Mocked<XCMetricsApi> = {
|
||||
const mockApi: jest.Mocked<XcmetricsApi> = {
|
||||
getBuilds: jest.fn().mockRejectedValue({ message: errorMessage }),
|
||||
};
|
||||
|
||||
|
||||
+1
-1
@@ -17,7 +17,7 @@ import React from 'react';
|
||||
import { Content, Header, HeaderLabel, Page } from '@backstage/core-components';
|
||||
import { OverviewComponent } from '../OverviewComponent';
|
||||
|
||||
export const XCMetricsPage = () => (
|
||||
export const XcmetricsLayout = () => (
|
||||
<Page themeId="tool">
|
||||
<Header title="XCMetrics" subtitle="Dashboard">
|
||||
<HeaderLabel label="Owner" value="Spotify" />
|
||||
+1
-1
@@ -13,4 +13,4 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
export * from './XCMetricsPage';
|
||||
export * from './XcmetricsLayout';
|
||||
@@ -19,7 +19,7 @@ import {
|
||||
createRoutableExtension,
|
||||
discoveryApiRef,
|
||||
} from '@backstage/core-plugin-api';
|
||||
import { xcmetricsApiRef, XCMetricsClient } from './api';
|
||||
import { xcmetricsApiRef, XcmetricsClient } from './api';
|
||||
import { rootRouteRef } from './routes';
|
||||
|
||||
export const xcmetricsPlugin = createPlugin({
|
||||
@@ -34,7 +34,7 @@ export const xcmetricsPlugin = createPlugin({
|
||||
discoveryApi: discoveryApiRef,
|
||||
},
|
||||
factory({ discoveryApi }) {
|
||||
return new XCMetricsClient({ discoveryApi });
|
||||
return new XcmetricsClient({ discoveryApi });
|
||||
},
|
||||
}),
|
||||
],
|
||||
@@ -43,7 +43,7 @@ export const xcmetricsPlugin = createPlugin({
|
||||
export const XcmetricsPage = xcmetricsPlugin.provide(
|
||||
createRoutableExtension({
|
||||
component: () =>
|
||||
import('./components/XCMetricsPage').then(m => m.XCMetricsPage),
|
||||
import('./components/XcmetricsLayout').then(m => m.XcmetricsLayout),
|
||||
mountPoint: rootRouteRef,
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user