UNPKG

testplane

Version:

Tests framework based on mocha and wdio

43 lines 1.26 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Test = void 0; const configurable_test_object_1 = require("./configurable-test-object"); class Test extends configurable_test_object_1.ConfigurableTestObject { static create(opts) { return new this(opts); } constructor({ title, file, id, location, fn, tags }) { super({ title, file, id, location }); this.fn = fn; this.tags = new Map(tags?.map(({ title, dynamic }) => [title, Boolean(dynamic)]) || []); } addTag(tag) { if (Array.isArray(tag)) { tag.forEach(element => this.tags.set(element, true)); } else { this.tags.set(tag, true); } } hasTag(tag) { return this.tags.has(tag); } getTags() { return Array.from(this.tags.keys()).map(title => ({ title, dynamic: this.tags.get(title), })); } clone() { return new Test({ title: this.title, tags: this.getTags(), file: this.file, id: this.id, location: this.location, fn: this.fn, }).assign(this); } } exports.Test = Test; //# sourceMappingURL=test.js.map