feat(eslint): enable vitest/no-identical-title (#9088)

Signed-off-by: axel7083 <42176370+axel7083@users.noreply.github.com>
This commit is contained in:
axel7083 2024-09-26 10:35:02 +02:00 committed by GitHub
parent f27047b89f
commit 72e287a0f3
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
19 changed files with 18 additions and 82 deletions

View file

@ -145,6 +145,7 @@ export default [
{
rules: {
'vitest/no-import-node-test': 'error',
'vitest/no-identical-title': 'error',
eqeqeq: 'error',
'prefer-promise-reject-errors': 'error',
semi: ['error', 'always'],

View file

@ -226,34 +226,6 @@ test('kubectl CLI tool not registered when version cannot be extracted from obje
});
});
test('kubectl CLI tool not registered when version cannot be extracted from object', async () => {
const wrongJsonStdout = {
clientVersion: {
...jsonStdout.clientVersion,
},
};
delete (wrongJsonStdout.clientVersion as any).gitVersion;
vi.mocked(extensionApi.process.exec).mockResolvedValue({
stderr: '',
stdout: JSON.stringify(wrongJsonStdout),
command: 'kubectl version --client=true -o=json',
});
const deferred = new Promise<void>(resolve => {
vi.spyOn(console, 'warn').mockImplementation((message: string) => {
log(message);
resolve();
});
});
await KubectlExtension.activate(extensionContext);
return deferred.then(() => {
expect(console.warn).toBeCalled();
expect(console.warn).toBeCalledWith(expect.stringContaining('Error: Cannot extract version from stdout'));
});
});
test('getStorageKubectlPath', async () => {
// get current directory
const currentDirectory = process.cwd();

View file

@ -143,7 +143,7 @@ test('expect applehv provider with applehv label', async () => {
expect(provider).equals(VMTYPE.APPLEHV);
});
test('expect provider name with provider different from libkrun and applehv', async () => {
test('expect wsl name with provider wsl label', async () => {
const provider = getProviderByLabel(VMTYPE.WSL);
expect(provider).equals(VMTYPE.WSL);
});

View file

@ -108,7 +108,7 @@ test('Expect native theme to be set to system', async () => {
expect(nativeTheme.themeSource).toEqual('system');
});
test('Expect native theme to be set to system', async () => {
test('Expect unknown theme to be set to system', async () => {
const appearanceInit: AppearanceInit = new AppearanceInit(configurationRegistry);
appearanceInit.updateNativeTheme('unknown');

View file

@ -532,7 +532,7 @@ describe('registerExtensionThemes', () => {
).toThrowError('Missing id property in theme. Extension foo.bar');
});
test('invalid theme (missing id) should throw error', async () => {
test('invalid theme should throw error', async () => {
expect(() =>
colorRegistry.registerExtensionThemes(fakeExtension, [{ id: 'foo' }] as unknown as RawThemeContribution[]),
).toThrowError('Missing parent property in theme. Extension foo.bar');

View file

@ -1603,10 +1603,6 @@ describe('buildImage', () => {
await verifyBuildImage({ cachefrom: 'quay.io/ubi9/ubi' });
});
test('verify buildImage receives correct args on non-Windows OS with cachefrom', async () => {
await verifyBuildImage({ cachefrom: 'quay.io/ubi9/ubi' });
});
test('verify buildImage receives correct args on non-Windows OS with pull', async () => {
await verifyBuildImage({ pull: 'quay.io/ubi9/ubi' });
});

View file

@ -761,7 +761,7 @@ test('Verify searchForMissingDependencies(analyzedExtensions);', async () => {
expect(analyzedExtension3.missingDependencies).toStrictEqual([unknownExtensionId]);
});
test('Verify searchForMissingDependencies(analyzedExtensions);', async () => {
test('Verify sortExtensionsByDependencies(analyzedExtensions);', async () => {
const extensionId1 = 'foo.extension1';
const extensionId2 = 'foo.extension2';
const extensionId3 = 'foo.extension3';

View file

@ -852,21 +852,6 @@ test('getAuthconfigForServer returns the expected authconfig', async () => {
expect(config?.serveraddress).toBe('my-podman-desktop-fake-registry.io');
});
test('getAuthconfigForServer returns the expected authconfig', async () => {
imageRegistry.registerRegistry({
serverUrl: 'my-podman-desktop-fake-registry.io',
username: 'foo',
secret: 'my-secret',
source: 'podman-desktop',
});
const config = imageRegistry.getAuthconfigForServer('my-podman-desktop-fake-registry.io');
expect(config).toBeDefined();
expect(config?.username).toBe('foo');
expect(config?.password).toBe('my-secret');
expect(config?.serveraddress).toBe('my-podman-desktop-fake-registry.io');
});
test('getAuthconfigForServer returns docker.io authconfig when server is index.docker.io', async () => {
imageRegistry.registerRegistry({
serverUrl: 'docker.io',

View file

@ -605,7 +605,7 @@ test('should return deployment list if connection to cluster is ok', async () =>
expect(list[0]?.metadata?.name).toEqual('deployment');
});
test('should throw error if cannot call the cluster', async () => {
test('should throw error if cannot call the cluster (readNamespacedDeployment reject)', async () => {
const client = createTestClient('default');
makeApiClientMock.mockReturnValue({
getCode: () => Promise.resolve({ body: { gitVersion: 'v1.20.0' } }),
@ -702,7 +702,7 @@ test('should return ingress list if connection to cluster is ok', async () => {
expect(list[0]?.metadata?.name).toEqual('ingress');
});
test('should throw error if cannot call the cluster', async () => {
test('should throw error if cannot call the cluster (readNamespacedIngress reject)', async () => {
const client = createTestClient('default');
makeApiClientMock.mockReturnValue({
getCode: () => Promise.resolve({ body: { gitVersion: 'v1.20.0' } }),
@ -816,7 +816,7 @@ test('should return route list if connection to cluster is ok', async () => {
expect(list[0]?.metadata?.name).toEqual('route');
});
test('should throw error if cannot call the cluster', async () => {
test('should throw error if cannot call the cluster (getNamespacedCustomObject reject)', async () => {
const client = createTestClient('default');
makeApiClientMock.mockReturnValue({
getCode: () => Promise.resolve({ body: { gitVersion: 'v1.20.0' } }),
@ -1004,7 +1004,7 @@ test('should return service list if connection to cluster is ok', async () => {
expect(list[0]?.metadata?.name).toEqual('service');
});
test('should throw error if cannot call the cluster', async () => {
test('should throw error if cannot call the cluster (readNamespacedService reject)', async () => {
const client = createTestClient('default');
makeApiClientMock.mockReturnValue({
getCode: () => Promise.resolve({ body: { gitVersion: 'v1.20.0' } }),

View file

@ -131,7 +131,7 @@ describe('an OnboardingRegistry instance exists', () => {
expect(onboarding?.status).toBe('completed');
});
test('Should throw if no onboarding for that extension', async () => {
test('updateStepState should throw if no onboarding for that extension', async () => {
expect(() => onboardingRegistry.updateStepState('completed', 'unknown', stepId)).toThrowError(
'No onboarding for extension unknown',
);
@ -167,7 +167,7 @@ describe('an OnboardingRegistry instance exists', () => {
expect('test' in context.collectAllValues()).toBe(false);
});
test('Should throw if no onboarding for that extension', async () => {
test('resetOnboarding should throw if no onboarding for that extension', async () => {
expect(() => onboardingRegistry.resetOnboarding(['unknown'])).toThrowError(
'No onboarding found for extensions unknown',
);

View file

@ -393,7 +393,7 @@ describe('expect update command to depends on context', async () => {
});
});
test('startup context', async () => {
test('status-bar-entry context', async () => {
const mListener = await getUpdateListener();
// Call the `update` command listener

View file

@ -128,7 +128,7 @@ describe('getTheme', () => {
expect(theme).toBe(customTheme);
});
test('should return custom value even if os is dark', async () => {
test('should return custom value even if os is dark when matches found', async () => {
(window as any).matchMedia = vi.fn().mockReturnValue({
matches: false,
addEventListener: vi.fn(),

View file

@ -117,7 +117,7 @@ describe('title', () => {
expect(title).toBeNull();
});
test('title should not be visible by default', async () => {
test('title should be visible when displayTitle is true', async () => {
render(FeaturedExtension, {
featuredExtension: fetchableFeaturedExtension,
displayTitle: true,

View file

@ -128,7 +128,7 @@ describe('PullImage', () => {
expect(button).toBeEnabled();
});
test('Expect that valid entry enables button', async () => {
test('Expect that valid entry enables button after user input', async () => {
setup();
render(PullImage);

View file

@ -78,7 +78,7 @@ test('Expect to see the checkbox disabled / unable to press when readonly is pas
expect(button).toBeDisabled();
});
test('Expect to see checkbox enabled', async () => {
test('Expect to see checkbox disabled with default to false', async () => {
const record: IConfigurationPropertyRecordedSchema = {
title: 'my boolean property',
id: 'myid',

View file

@ -70,7 +70,7 @@ test('write array with mixed values', () => {
expect(xtermMock.write).toBeCalledWith(expect.stringContaining('ok'));
});
test('write array of array object', () => {
test('write empty array of array object should not call write', () => {
writeToTerminal(xtermMock, [], 'test');
// no error reported
expect(xtermMock.write).not.toBeCalled();

View file

@ -60,7 +60,7 @@ test('Ensure placeholder is correctly used', async () => {
expect((input as HTMLInputElement).placeholder).toBe(record.placeholder);
});
test('Ensure HTMLInputElement', async () => {
test('Ensure HTMLInputElement readonly', async () => {
const record: IConfigurationPropertyRecordedSchema = {
id: 'record',
title: 'record',

View file

@ -30,13 +30,6 @@ test('should expect valid match with string', async () => {
expect(findMatchInLeaves(object, 'foo')).toBe(false);
});
test('should expect valid match with array of string', async () => {
const object = ['a', 'b', 'my super name'];
expect(findMatchInLeaves(object, 'name')).toBe(true);
expect(findMatchInLeaves(object, 'b')).toBe(true);
expect(findMatchInLeaves(object, 'foo')).toBe(false);
});
test('should expect valid match with string and case', async () => {
const object = 'NgInX';
expect(findMatchInLeaves(object, 'nginx')).toBe(true);

View file

@ -128,17 +128,6 @@ describe('StorybookSidebarBuilder', () => {
}).toThrowError('missing entries in storybook index');
});
test('missing entries should an error', () => {
const builder = new StorybookSidebarBuilder();
expect(() => {
builder
.fromStorybookIndex({
v: 5,
})
.build();
}).toThrowError('missing entries in storybook index');
});
test('no entries should return an empty array', () => {
const builder = new StorybookSidebarBuilder();
const result = builder