diff --git a/tests/settings/connected-components-settings.spec.ts b/tests/settings/connected-components-settings.spec.ts index e6d01fac..be4fa6b0 100644 --- a/tests/settings/connected-components-settings.spec.ts +++ b/tests/settings/connected-components-settings.spec.ts @@ -3,6 +3,7 @@ Licensed under the Apache License, Version 2.0. */ +import { TemporaryDefines } from '@src/helpers/temporary-defines'; import { ConnectedComponentsSettings } from '@src/settings/connected-components-settings'; import { Threshold } from '@src/types/threshold'; import { TestImages } from '@test/test-images'; @@ -23,30 +24,20 @@ describe('ConnectedComponentsSettings', () => { describe('#_addArtifacts', () => { it('should add all defined artifacts to the provided image', () => { TestImages.Builtin.logo.use((image) => { - settings._setArtifacts(image); + TemporaryDefines.use(image, (temporaryDefines) => { + settings._setArtifacts(temporaryDefines); - expect(image.artifactNames.length).toBe(9); - expect(image.getArtifact('connected-components:angle-threshold')).toBe('10'); - expect(image.getArtifact('connected-components:area-threshold')).toBe('20'); - expect(image.getArtifact('connected-components:circularity-threshold')).toBe('30'); - expect(image.getArtifact('connected-components:diameter-threshold')).toBe('40'); - expect(image.getArtifact('connected-components:eccentricity-threshold')).toBe('50'); - expect(image.getArtifact('connected-components:major-axis-threshold')).toBe('60'); - expect(image.getArtifact('connected-components:mean-color')).toBe('true'); - expect(image.getArtifact('connected-components:minor-axis-threshold')).toBe('70'); - expect(image.getArtifact('connected-components:perimeter-threshold')).toBe('80'); - }); - }); - }); - - describe('#_removeArtifacts', () => { - it('should remove all undefined artifacts from the provided image', () => { - TestImages.Builtin.logo.use((image) => { - settings._setArtifacts(image); - expect(image.artifactNames.length).toBe(9); - - settings._removeArtifacts(image); - expect(image.artifactNames.length).toBe(0); + expect(image.artifactNames.length).toBe(9); + expect(image.getArtifact('connected-components:angle-threshold')).toBe('10'); + expect(image.getArtifact('connected-components:area-threshold')).toBe('20'); + expect(image.getArtifact('connected-components:circularity-threshold')).toBe('30'); + expect(image.getArtifact('connected-components:diameter-threshold')).toBe('40'); + expect(image.getArtifact('connected-components:eccentricity-threshold')).toBe('50'); + expect(image.getArtifact('connected-components:major-axis-threshold')).toBe('60'); + expect(image.getArtifact('connected-components:mean-color')).toBe('true'); + expect(image.getArtifact('connected-components:minor-axis-threshold')).toBe('70'); + expect(image.getArtifact('connected-components:perimeter-threshold')).toBe('80'); + }); }); }); });