Fix linting errors after #13392
Signed-off-by: Fredrik Adelöw <freben@gmail.com>
This commit is contained in:
@@ -72,9 +72,11 @@ describe('useKubernetesObjects', () => {
|
||||
const mockDecorateRequestBodyForAuth = jest.fn();
|
||||
|
||||
const expectMocksCalledCorrectly = (numOfCalls: number = 1) => {
|
||||
expect(mockGetClusters).toBeCalledTimes(numOfCalls);
|
||||
expect(mockGetClusters).toHaveBeenCalledTimes(numOfCalls);
|
||||
expect(mockGetClusters).toHaveBeenLastCalledWith();
|
||||
expect(mockDecorateRequestBodyForAuth).toBeCalledTimes(numOfCalls * 2);
|
||||
expect(mockDecorateRequestBodyForAuth).toHaveBeenCalledTimes(
|
||||
numOfCalls * 2,
|
||||
);
|
||||
expect(mockDecorateRequestBodyForAuth).toHaveBeenCalledWith('google', {
|
||||
entity,
|
||||
});
|
||||
@@ -82,7 +84,7 @@ describe('useKubernetesObjects', () => {
|
||||
'authprovider2',
|
||||
entityWithAuthToken,
|
||||
);
|
||||
expect(mockGetObjectsByEntity).toBeCalledTimes(numOfCalls);
|
||||
expect(mockGetObjectsByEntity).toHaveBeenCalledTimes(numOfCalls);
|
||||
expect(mockGetObjectsByEntity).toHaveBeenLastCalledWith(
|
||||
entityWithAuthToken,
|
||||
);
|
||||
@@ -166,10 +168,10 @@ describe('useKubernetesObjects', () => {
|
||||
expect(result.current.error).toBe('some-error');
|
||||
expect(result.current.kubernetesObjects).toBeUndefined();
|
||||
|
||||
expect(mockGetClusters).toBeCalledTimes(1);
|
||||
expect(mockGetClusters).toHaveBeenCalledTimes(1);
|
||||
expect(mockGetClusters).toHaveBeenLastCalledWith();
|
||||
expect(mockDecorateRequestBodyForAuth).toBeCalledTimes(0);
|
||||
expect(mockGetObjectsByEntity).toBeCalledTimes(0);
|
||||
expect(mockDecorateRequestBodyForAuth).toHaveBeenCalledTimes(0);
|
||||
expect(mockGetObjectsByEntity).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
it('should return error when decorateRequestBodyForAuth throws', async () => {
|
||||
(useApi as any).mockReturnValue({
|
||||
@@ -189,12 +191,12 @@ describe('useKubernetesObjects', () => {
|
||||
expect(result.current.error).toBe('some-error');
|
||||
expect(result.current.kubernetesObjects).toBeUndefined();
|
||||
|
||||
expect(mockGetClusters).toBeCalledTimes(1);
|
||||
expect(mockGetClusters).toHaveBeenCalledTimes(1);
|
||||
expect(mockGetClusters).toHaveBeenLastCalledWith();
|
||||
expect(mockDecorateRequestBodyForAuth).toBeCalledTimes(1);
|
||||
expect(mockDecorateRequestBodyForAuth).toHaveBeenCalledTimes(1);
|
||||
expect(mockDecorateRequestBodyForAuth).toHaveBeenCalledWith('google', {
|
||||
entity,
|
||||
});
|
||||
expect(mockGetObjectsByEntity).toBeCalledTimes(0);
|
||||
expect(mockGetObjectsByEntity).toHaveBeenCalledTimes(0);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,9 +42,7 @@ describe('clusterLinks', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError(
|
||||
"Could not find Kubernetes dashboard app named 'unknownapp'",
|
||||
);
|
||||
).toThrow("Could not find Kubernetes dashboard app named 'unknownapp'");
|
||||
});
|
||||
|
||||
describe('default app', () => {
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('clusterLinks - AKS formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError('AKS dashboard requires a dashboardParameters option');
|
||||
).toThrow('AKS dashboard requires a dashboardParameters option');
|
||||
});
|
||||
it('should provide a subscriptionId in the dashboardParameters options', () => {
|
||||
expect(() =>
|
||||
@@ -44,7 +44,7 @@ describe('clusterLinks - AKS formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError(
|
||||
).toThrow(
|
||||
'AKS dashboard requires a "subscriptionId" of type string in the dashboardParameters option',
|
||||
);
|
||||
});
|
||||
@@ -63,7 +63,7 @@ describe('clusterLinks - AKS formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError(
|
||||
).toThrow(
|
||||
'AKS dashboard requires a "resourceGroup" of type string in the dashboardParameters option',
|
||||
);
|
||||
});
|
||||
@@ -82,7 +82,7 @@ describe('clusterLinks - AKS formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError(
|
||||
).toThrow(
|
||||
'AKS dashboard requires a "clusterName" of type string in the dashboardParameters option',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -28,6 +28,6 @@ describe('clusterLinks - EKS formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError('EKS formatter is not yet implemented. Please, contribute!');
|
||||
).toThrow('EKS formatter is not yet implemented. Please, contribute!');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('clusterLinks - GKE formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError('GKE dashboard requires a dashboardParameters option');
|
||||
).toThrow('GKE dashboard requires a dashboardParameters option');
|
||||
});
|
||||
it('should provide a projectId in the dashboardParameters options', () => {
|
||||
expect(() =>
|
||||
@@ -44,7 +44,7 @@ describe('clusterLinks - GKE formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError(
|
||||
).toThrow(
|
||||
'GKE dashboard requires a "projectId" of type string in the dashboardParameters option',
|
||||
);
|
||||
});
|
||||
@@ -63,7 +63,7 @@ describe('clusterLinks - GKE formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError(
|
||||
).toThrow(
|
||||
'GKE dashboard requires a "region" of type string in the dashboardParameters option',
|
||||
);
|
||||
});
|
||||
@@ -82,7 +82,7 @@ describe('clusterLinks - GKE formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError(
|
||||
).toThrow(
|
||||
'GKE dashboard requires a "clusterName" of type string in the dashboardParameters option',
|
||||
);
|
||||
});
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('clusterLinks - OpenShift formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError('OpenShift dashboard requires a dashboardUrl option');
|
||||
).toThrow('OpenShift dashboard requires a dashboardUrl option');
|
||||
});
|
||||
it('should return an url on the workloads when there is a namespace only', () => {
|
||||
const url = openshiftFormatter({
|
||||
|
||||
@@ -27,7 +27,7 @@ describe('clusterLinks - rancher formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError('Rancher dashboard requires a dashboardUrl option');
|
||||
).toThrow('Rancher dashboard requires a dashboardUrl option');
|
||||
});
|
||||
it('should return a url on the workloads when there is a namespace only', () => {
|
||||
const url = rancherFormatter({
|
||||
|
||||
@@ -34,7 +34,7 @@ describe('clusterLinks - standard formatter', () => {
|
||||
},
|
||||
kind: 'Deployment',
|
||||
}),
|
||||
).toThrowError('standard dashboard requires a dashboardUrl option');
|
||||
).toThrow('standard dashboard requires a dashboardUrl option');
|
||||
});
|
||||
it('should return an url on the workloads when there is a namespace only', () => {
|
||||
const url = standardFormatter({
|
||||
|
||||
Reference in New Issue
Block a user