approvals
Version:
Approval Tests Library - Capturing Human Intelligence
28 lines (25 loc) • 560 B
text/typescript
export abstract class Wrapper<Type> {
abstract get(): Type;
}
export class SingleWrapper<Type> extends Wrapper<Type> {
protected instance: Type;
constructor(instance: Type) {
super();
this.instance = instance;
}
get(): Type {
return this.instance;
}
}
export class ThreadedWrapper<Type> extends Wrapper<Type> {
protected local: Type;
protected generator: () => Type;
constructor(generator: () => Type) {
super();
this.generator = generator;
this.local = generator();
}
get(): Type {
return this.local;
}
}