@autorest/test-utils
Version:
Set of testing utils that are used across packages
25 lines • 870 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createDataHandle = createDataHandle;
const datastore_1 = require("@azure-tools/datastore");
/**
* Create a data handle from some string content.
* @param content Content of the file
* @returns DataHandle.
*/
function createDataHandle(content, props = {}) {
var _a;
const name = (_a = props.name) !== null && _a !== void 0 ? _a : "test-generated";
const key = name.includes("://") ? name : `mem://${name}`;
return new datastore_1.DataHandle(key, {
status: "loaded",
name,
identity: [name],
artifactType: "",
cached: content,
lineIndices: (0, datastore_1.getLineIndices)(content),
positionSourceMap: undefined,
pathSourceMap: undefined,
}, false);
}
//# sourceMappingURL=data-store-test-utils.js.map