Page MenuHomePhabricator

Front-End unit tests: some false positives when checking the existence of components
Closed, ResolvedPublic


In these tests, if I understand correctly, we don't test well the existence of components:

50:		expect( wrapper.findComponent( FunctionDefinitionName ) ).toBeTruthy();
51:		expect( wrapper.findComponent( FunctionDefinitionAliases ) ).toBeTruthy();
52:		expect( wrapper.findComponent( FunctionDefinitionInputs ) ).toBeTruthy();
53:		expect( wrapper.findComponent( FunctionDefinitionOutput ) ).toBeTruthy();
54:		expect( wrapper.findComponent( FunctionDefinitionFooter ) ).toBeTruthy();

40:		expect( wrapper.findComponent( FunctionViewerSidebar ) ).toBeTruthy();

56:		expect( wrapper.findComponent( DialogContainer ) ).toBeTruthy();

52:		expect( wrapper.findComponent( TableComponent ) ).toBeTruthy();

40:		expect( wrapper.findComponent( FunctionViewerSidebar ) ).toBeTruthy();

findComponent just returns a new wrapper, which may not hold anything. When we remove the corresponding component from the tested modules, the tests continue to pass (I checked that with FunctionDefinition.test.js).

If we want to check the existence of components, we also rather call .exists(). An example of a well written test (I checked that it gives a true positive and fails when we remove the component):

However, when I attempt to add a .exists() to the false positive tests, the test fails.

Event Timeline

Change 828901 had a related patch set uploaded (by Teleosteen; author: Teleosteen):

[mediawiki/extensions/WikiLambda@master] Fix false positives when checking the existence of components

Change 828901 merged by jenkins-bot:

[mediawiki/extensions/WikiLambda@master] Fix false positives when checking the existence of components