All files / src/functions fix.tags.ts

100% Statements 10/10
100% Branches 14/14
100% Functions 2/2
100% Lines 8/8

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13    6x 31x 31x 31x   30x 30x 30x   6x  
'use strict';
 
const fixTags: Function = (route: any, relativeFilePath: string): string[] => {
	const schema: any = route.schema ?? {};
	const tags: string[] = schema.tags ?? [];
	if (tags.length > 0) return tags.map((tag: string): string => tag.toUpperCase());
 
	const words: RegExpMatchArray | [] = relativeFilePath.match(/\w+/g) || [];
	const firstPath: string = words[0] || '';
	return [firstPath.toUpperCase()];
};
export default fixTags;