Aktueller Stand
This commit is contained in:
39
backend/node_modules/fast-check/lib/check/model/commands/CommandWrapper.js
generated
vendored
Normal file
39
backend/node_modules/fast-check/lib/check/model/commands/CommandWrapper.js
generated
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CommandWrapper = void 0;
|
||||
const stringify_1 = require("../../../utils/stringify");
|
||||
const symbols_1 = require("../../symbols");
|
||||
class CommandWrapper {
|
||||
constructor(cmd) {
|
||||
this.cmd = cmd;
|
||||
this.hasRan = false;
|
||||
if ((0, stringify_1.hasToStringMethod)(cmd)) {
|
||||
const method = cmd[stringify_1.toStringMethod];
|
||||
this[stringify_1.toStringMethod] = function toStringMethod() {
|
||||
return method.call(cmd);
|
||||
};
|
||||
}
|
||||
if ((0, stringify_1.hasAsyncToStringMethod)(cmd)) {
|
||||
const method = cmd[stringify_1.asyncToStringMethod];
|
||||
this[stringify_1.asyncToStringMethod] = function asyncToStringMethod() {
|
||||
return method.call(cmd);
|
||||
};
|
||||
}
|
||||
}
|
||||
check(m) {
|
||||
return this.cmd.check(m);
|
||||
}
|
||||
run(m, r) {
|
||||
this.hasRan = true;
|
||||
return this.cmd.run(m, r);
|
||||
}
|
||||
clone() {
|
||||
if ((0, symbols_1.hasCloneMethod)(this.cmd))
|
||||
return new CommandWrapper(this.cmd[symbols_1.cloneMethod]());
|
||||
return new CommandWrapper(this.cmd);
|
||||
}
|
||||
toString() {
|
||||
return this.cmd.toString();
|
||||
}
|
||||
}
|
||||
exports.CommandWrapper = CommandWrapper;
|
||||
2
backend/node_modules/fast-check/lib/check/model/commands/CommandsContraints.js
generated
vendored
Normal file
2
backend/node_modules/fast-check/lib/check/model/commands/CommandsContraints.js
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
25
backend/node_modules/fast-check/lib/check/model/commands/CommandsIterable.js
generated
vendored
Normal file
25
backend/node_modules/fast-check/lib/check/model/commands/CommandsIterable.js
generated
vendored
Normal file
@@ -0,0 +1,25 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.CommandsIterable = void 0;
|
||||
const symbols_1 = require("../../symbols");
|
||||
class CommandsIterable {
|
||||
constructor(commands, metadataForReplay) {
|
||||
this.commands = commands;
|
||||
this.metadataForReplay = metadataForReplay;
|
||||
}
|
||||
[Symbol.iterator]() {
|
||||
return this.commands[Symbol.iterator]();
|
||||
}
|
||||
[symbols_1.cloneMethod]() {
|
||||
return new CommandsIterable(this.commands.map((c) => c.clone()), this.metadataForReplay);
|
||||
}
|
||||
toString() {
|
||||
const serializedCommands = this.commands
|
||||
.filter((c) => c.hasRan)
|
||||
.map((c) => c.toString())
|
||||
.join(',');
|
||||
const metadata = this.metadataForReplay();
|
||||
return metadata.length !== 0 ? `${serializedCommands} /*${metadata}*/` : serializedCommands;
|
||||
}
|
||||
}
|
||||
exports.CommandsIterable = CommandsIterable;
|
||||
58
backend/node_modules/fast-check/lib/check/model/commands/ScheduledCommand.js
generated
vendored
Normal file
58
backend/node_modules/fast-check/lib/check/model/commands/ScheduledCommand.js
generated
vendored
Normal file
@@ -0,0 +1,58 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.scheduleCommands = exports.ScheduledCommand = void 0;
|
||||
class ScheduledCommand {
|
||||
constructor(s, cmd) {
|
||||
this.s = s;
|
||||
this.cmd = cmd;
|
||||
}
|
||||
async check(m) {
|
||||
let error = null;
|
||||
let checkPassed = false;
|
||||
const status = await this.s.scheduleSequence([
|
||||
{
|
||||
label: `check@${this.cmd.toString()}`,
|
||||
builder: async () => {
|
||||
try {
|
||||
checkPassed = await Promise.resolve(this.cmd.check(m));
|
||||
}
|
||||
catch (err) {
|
||||
error = err;
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
},
|
||||
]).task;
|
||||
if (status.faulty) {
|
||||
throw error;
|
||||
}
|
||||
return checkPassed;
|
||||
}
|
||||
async run(m, r) {
|
||||
let error = null;
|
||||
const status = await this.s.scheduleSequence([
|
||||
{
|
||||
label: `run@${this.cmd.toString()}`,
|
||||
builder: async () => {
|
||||
try {
|
||||
await this.cmd.run(m, r);
|
||||
}
|
||||
catch (err) {
|
||||
error = err;
|
||||
throw err;
|
||||
}
|
||||
},
|
||||
},
|
||||
]).task;
|
||||
if (status.faulty) {
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
}
|
||||
exports.ScheduledCommand = ScheduledCommand;
|
||||
const scheduleCommands = function* (s, cmds) {
|
||||
for (const cmd of cmds) {
|
||||
yield new ScheduledCommand(s, cmd);
|
||||
}
|
||||
};
|
||||
exports.scheduleCommands = scheduleCommands;
|
||||
Reference in New Issue
Block a user