({
driver,
metric,
reporter,
validator,
prepare,
execute,
}: {
driver?: any;
metric?: Metric;
reporter?: Reporter;
validator?: Validator;
prepare?: any;
execute?: any;
} = {})
| 22 | const EMPTY_EXECUTE = () => {}; |
| 23 | |
| 24 | function createSampler({ |
| 25 | driver, |
| 26 | metric, |
| 27 | reporter, |
| 28 | validator, |
| 29 | prepare, |
| 30 | execute, |
| 31 | }: { |
| 32 | driver?: any; |
| 33 | metric?: Metric; |
| 34 | reporter?: Reporter; |
| 35 | validator?: Validator; |
| 36 | prepare?: any; |
| 37 | execute?: any; |
| 38 | } = {}) { |
| 39 | let time = 1000; |
| 40 | if (!metric) { |
| 41 | metric = new MockMetric([]); |
| 42 | } |
| 43 | if (!reporter) { |
| 44 | reporter = new MockReporter([]); |
| 45 | } |
| 46 | if (driver == null) { |
| 47 | driver = new MockDriverAdapter([]); |
| 48 | } |
| 49 | const providers = [ |
| 50 | Options.DEFAULT_PROVIDERS, |
| 51 | Sampler.PROVIDERS, |
| 52 | {provide: Metric, useValue: metric}, |
| 53 | {provide: Reporter, useValue: reporter}, |
| 54 | {provide: WebDriverAdapter, useValue: driver}, |
| 55 | {provide: Options.EXECUTE, useValue: execute}, |
| 56 | {provide: Validator, useValue: validator}, |
| 57 | {provide: Options.NOW, useValue: () => new Date(time++)}, |
| 58 | ]; |
| 59 | if (prepare != null) { |
| 60 | providers.push({provide: Options.PREPARE, useValue: prepare}); |
| 61 | } |
| 62 | |
| 63 | sampler = Injector.create({providers}).get(Sampler); |
| 64 | } |
| 65 | |
| 66 | it('should call the prepare and execute callbacks using WebDriverAdapter.waitFor', (done) => { |
| 67 | const log: any[] = []; |
no test coverage detected
searching dependent graphs…