@@ -14,9 +14,11 @@ import {
1414 getNonEmptyLabelsFromProject ,
1515 getNotEmptyLabelsFromOneTask ,
1616 isAnomalous ,
17+ isEmptyOrBackgroundLabel ,
1718 isExclusive ,
1819 isGlobal ,
1920 isLocal ,
21+ isNonEmptyOrBackgroundLabel ,
2022} from './utils' ;
2123
2224it . each ( [
@@ -263,3 +265,47 @@ describe('filter out exclusive labels', () => {
263265 expect ( filterOutExclusiveLabel ( labels ) ) . toHaveLength ( 0 ) ;
264266 } ) ;
265267} ) ;
268+
269+ describe ( 'isEmptyOrBackgroundLabel' , ( ) => {
270+ it ( 'returns true for a label that is empty' , ( ) => {
271+ const label = { isEmpty : true , behaviour : LABEL_BEHAVIOUR . LOCAL } ;
272+ expect ( isEmptyOrBackgroundLabel ( label ) ) . toBe ( true ) ;
273+ } ) ;
274+
275+ it ( 'returns true for a label that is background' , ( ) => {
276+ const label = { isEmpty : false , behaviour : LABEL_BEHAVIOUR . BACKGROUND } ;
277+ expect ( isEmptyOrBackgroundLabel ( label ) ) . toBe ( true ) ;
278+ } ) ;
279+
280+ it ( 'returns true for a label that is both empty and background' , ( ) => {
281+ const label = { isEmpty : true , behaviour : LABEL_BEHAVIOUR . BACKGROUND } ;
282+ expect ( isEmptyOrBackgroundLabel ( label ) ) . toBe ( true ) ;
283+ } ) ;
284+
285+ it ( 'returns false for a label that is neither empty nor background' , ( ) => {
286+ const label = { isEmpty : false , behaviour : LABEL_BEHAVIOUR . LOCAL } ;
287+ expect ( isEmptyOrBackgroundLabel ( label ) ) . toBe ( false ) ;
288+ } ) ;
289+ } ) ;
290+
291+ describe ( 'isNonEmptyOrBackgroundLabel' , ( ) => {
292+ it ( 'returns false for a label that is empty' , ( ) => {
293+ const label = { isEmpty : true , behaviour : LABEL_BEHAVIOUR . LOCAL } ;
294+ expect ( isNonEmptyOrBackgroundLabel ( label ) ) . toBe ( false ) ;
295+ } ) ;
296+
297+ it ( 'returns false for a label that is background' , ( ) => {
298+ const label = { isEmpty : false , behaviour : LABEL_BEHAVIOUR . BACKGROUND } ;
299+ expect ( isNonEmptyOrBackgroundLabel ( label ) ) . toBe ( false ) ;
300+ } ) ;
301+
302+ it ( 'returns false for a label that is both empty and background' , ( ) => {
303+ const label = { isEmpty : true , behaviour : LABEL_BEHAVIOUR . BACKGROUND } ;
304+ expect ( isNonEmptyOrBackgroundLabel ( label ) ) . toBe ( false ) ;
305+ } ) ;
306+
307+ it ( 'returns true for a label that is neither empty nor background' , ( ) => {
308+ const label = { isEmpty : false , behaviour : LABEL_BEHAVIOUR . LOCAL } ;
309+ expect ( isNonEmptyOrBackgroundLabel ( label ) ) . toBe ( true ) ;
310+ } ) ;
311+ } ) ;
0 commit comments