jest-cucumber
Version:
Execute Gherkin scenarios in Jest
36 lines • 1.5 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
var src_1 = require("../../../../src/");
var todo_list_1 = require("../../src/todo-list");
var feature = src_1.loadFeature('./examples/typescript/specs/features/using-gherkin-tables.feature');
src_1.defineFeature(feature, function (test) {
var todoList;
beforeEach(function () {
todoList = new todo_list_1.TodoList();
});
test('Adding an item to my todo list', function (_a) {
var given = _a.given, when = _a.when, then = _a.then;
given('my todo list currently looks as follows:', function (table) {
table.forEach(function (row) {
todoList.add({
name: row.TaskName,
priority: row.Priority,
});
});
});
when('I add the following task:', function (table) {
todoList.add({
name: table[0].TaskName,
priority: table[0].Priority,
});
});
then('I should see the following todo list:', function (table) {
expect(todoList.items.length).toBe(table.length);
table.forEach(function (row, index) {
expect(todoList.items[index].name).toBe(table[index].TaskName);
expect(todoList.items[index].priority).toBe(table[index].Priority);
});
});
});
});
//# sourceMappingURL=using-gherkin-tables.steps.js.map