How to use the tiny-types.ensure function in tiny-types

To help you get started, weā€™ve selected a few tiny-types examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jan-molak / serenity-js / packages / cucumber / src / listeners / CucumberEventProtocolAdapter.ts View on Github external
eventBroadcaster.on('test-step-finished', ({ index, result, testCase }) => {

                ensure('test-step-finished :: index', index, isDefined());
                ensure('test-step-finished :: result', result, isDefined());
                ensure('test-step-finished :: testCase', testCase, isDefined());

                const
                    map      = cache.get(new Path(testCase.sourceLocation.uri)),
                    scenario = map.get(Scenario).onLine(testCase.sourceLocation.line),
                    step     = scenario.steps[index];

                if (step instanceof Step) { // ignore hooks
                    notifier.stepFinished(step, this.outcomeFrom(result));
                }
            });
github jan-molak / serenity-js / packages / core / src / stage / crew / artifact-archiver / Hash.ts View on Github external
constructor(public readonly value: string) {
        super();
        ensure(this.constructor.name, value, isDefined());
    }
github jan-molak / serenity-js / packages / cucumber / src / listeners / CucumberEventProtocolAdapter.ts View on Github external
eventBroadcaster.on('test-case-finished', ({ result, sourceLocation }) => {

                ensure('test-case-finished :: result', result, isDefined());
                ensure('test-case-finished :: sourceLocation', sourceLocation, isDefined());

                const
                    map             = cache.get(new Path(sourceLocation.uri)),
                    scenario        = map.get(Scenario).onLine(sourceLocation.line),
                    nonHookSteps    = scenario.steps.filter(step => step instanceof Step);

                const outcome: Outcome = nonHookSteps.length > 0
                    ? this.outcomeFrom(result)
                    : new ImplementationPending(new ImplementationPendingError(`"${ scenario.name.value }" has no test steps`));

                notifier.scenarioFinished(scenario, map.getFirst(Feature), outcome);
            });
        }
github jan-molak / serenity-js / packages / core / src / model / Category.ts View on Github external
constructor(public readonly value: string) {
        super();
        ensure(this.constructor.name, value, isDefined());
    }
}
github jan-molak / serenity-js / packages / core / src / stage / Stage.ts View on Github external
constructor(
        private dressingRoom: DressingRoom,
        private readonly manager: StageManager,
    ) {
        ensure('DressingRoom', dressingRoom, isDefined());
        ensure('StageManager', manager, isDefined());
    }
github jan-molak / serenity-js / packages / core / src / events / SceneDescriptionDetected.ts View on Github external
constructor(
        public readonly description: Description,
    ) {
        super();
        ensure('description', description, isDefined());
    }
}