All files / app/src/features/validator/validate-objects/lib validate-common-warehouse-contract.ts

100% Statements 5/5
100% Branches 4/4
100% Functions 1/1
100% Lines 5/5

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    1x 13x 13x 13x 13x  
import { SelectedAccountingObject } from '@/entities/accounting-object'
 
export const validateCommonWarehouseContract = (objects: SelectedAccountingObject[]) => {
  if (!objects.length) return true
  const referenceWarehouseContract = objects?.[0].warehouseContract
  return !objects.every(item => item.warehouseContract === referenceWarehouseContract)
}