This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { getFromContainer, IsDateString, IsEmail, IsNumber, IsOptional, IsString, Max, MaxLength, MetadataStorage, validate } from 'class-validator'; | |
import { ValidationMetadata } from 'class-validator/metadata/ValidationMetadata'; | |
import _ from 'lodash'; | |
import { InheritValidation } from './inherit-validation.dtodep.decorator'; | |
/** | |
* Used as a base for validation, in order for partial classes | |
* to pick validation metadatas, property by property. | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TimeoutError } from 'rxjs'; | |
import { waitForAssertion } from './wait-for-assertion'; | |
describe('waitForAssertion', () => { | |
let mockWitness: jest.Mock; | |
beforeEach(() => { | |
mockWitness = jest.fn().mockReturnValue(false); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Count the number of calendar days between two dates given as | |
/// timestamps in milliseconds. Make the assumption that One day is | |
/// 86_400_000 milliseconds (leap seconds are ignored). | |
pub fn count_days_between(timestamp_ms_a: u64, timestamp_ms_b: u64) -> u64 { | |
let days_count_a = timestamp_ms_a / 1000 / 3600 / 24; | |
let days_count_b = timestamp_ms_b / 1000 / 3600 / 24; | |
let days_count_between = match days_count_a.checked_sub(days_count_b) { | |
Some(difference) => difference, | |
None => days_count_b - days_count_a, | |
}; |