All files / metadata/src/utilities/metadataProvider transferSyntaxProvider.ts

100% Statements 6/6
66.66% Branches 4/6
100% Functions 2/2
100% Lines 6/6

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 14 15 16 17 18 19 20 21 22 23 24          90x 90x   45x 45x 45x                     384x    
import { MetadataModules } from '../../enums';
import { addTypedProvider } from '../../metaData';
import isVideoTransferSyntax from '../isVideoTransferSyntax';
 
export function transferSyntaxProvider(next, query, data, options) {
  const fmiBase = next(query, data, options);
  if (fmiBase) {
    const transferSyntaxUID =
      fmiBase.transferSyntaxUID || fmiBase.availableTransferSyntaxUID;
    const isVideo = isVideoTransferSyntax(transferSyntaxUID);
    return {
      ...fmiBase,
      transferSyntaxUID: Array.isArray(transferSyntaxUID)
        ? transferSyntaxUID[0]
        : transferSyntaxUID,
      isVideo,
    };
  }
}
 
export function registerTransferSyntaxProvider() {
  addTypedProvider(MetadataModules.TRANSFER_SYNTAX, transferSyntaxProvider);
}