UNPKG

@atomist/rug

Version:

TypeScript model for Atomist Rugs, see http://docs.atomist.com/

103 lines (102 loc) 2.79 kB
"use strict"; /* * Copyright © 2017 Atomist, Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ Object.defineProperty(exports, "__esModule", { value: true }); var Core_1 = require("./Core"); var ScenarioWorld_1 = require("../ScenarioWorld"); // Register well-known steps /** * Empty project. */ Core_1.Given("an empty project", function (p) { return; }); /** * Cloned content from GitHub. */ Core_1.Given("github ([^/]+)/([^/]+)", function (p, w, owner, name) { var repo = new ScenarioWorld_1.CloneInfo(owner, name); var project = w.cloneRepo(repo); w.setProject(project); }); /** * Cloned branch from GitHub. */ Core_1.Given("github ([^/]+)/([^/]+)/([^/]+)", function (p, w, owner, name, branch) { var repo = new ScenarioWorld_1.CloneInfo(owner, name).withBranch(branch); var project = w.cloneRepo(repo); w.setProject(project); }); /** * The entire contents of the Rug archive project. */ Core_1.Given("the archive root", function (p) { p.copyEditorBackingFilesPreservingPath(""); }); /** * The contents of this archive, excluding Atomist content. */ Core_1.Given("archive non Atomist content", function (p) { p.copyEditorBackingProject(); }); /** * Editor made changes. */ Core_1.Then("changes were made", function (p, w) { return w.modificationsMade(); }); /** * Editor made NoChange. */ Core_1.Then("no changes were made", function (p, w) { return !w.modificationsMade(); }); /** * Valid parameters. */ Core_1.Then("parameters were valid", function (p, w) { return w.invalidParameters() === null; }); /** * Invalid parameters. */ Core_1.Then("parameters were invalid", function (p, w) { return w.invalidParameters() !== null; }); /** * Generic file existence check. */ Core_1.Then("file at ([^ ]+) should exist", function (p, w, path) { return p.fileExists(path); }); /** * Generic file content check. */ Core_1.Then("file at ([^ ]+) should contain (.*)", function (p, w, path, searchString) { return p.fileContains(path, searchString); }); /** * When step should fail. */ Core_1.Then("it should fail", function (p, w) { w.failed(); }); /** * The scenario was aborted due to an exception being thrown. */ Core_1.Then("the scenario aborted", function (p, w) { w.aborted(); });