MCPcopy Create free account
hub / github.com/firebase/firebase-tools / newTestRun

Function newTestRun

scripts/dataconnect-test/tests.ts:97–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

95
96// Each test run should use a random serviceId and databaseId.
97function newTestRun(): { serviceId: string; databaseId: string } {
98 const id = getRandomString(6);
99 const serviceId = `cli-e2e-service-${id}`;
100 const databaseId = `cli-e2e-database-${id}`;
101
102 const dataconnectYamlTemplate = fs.readFileSync(toPath("templates/dataconnect.yaml")).toString();
103 const connectorYamlTemplate = fs.readFileSync(toPath("templates/connector.yaml")).toString();
104 const subbedDataconnectYaml = dataconnectYamlTemplate
105 .replace("__serviceId__", serviceId)
106 .replace("__databaseId__", databaseId);
107 if (!fs.existsSync(fdcTest)) {
108 fs.mkdirSync(fdcTest);
109 }
110 if (!fs.existsSync(toPath("fdc-test/connector"))) {
111 fs.mkdirSync(toPath("fdc-test/connector"));
112 }
113 if (!fs.existsSync(toPath("fdc-test/schema"))) {
114 fs.mkdirSync(toPath("fdc-test/schema"));
115 }
116 fs.writeFileSync(toPath("fdc-test/dataconnect.yaml"), subbedDataconnectYaml, {
117 mode: 420 /* 0o644 */,
118 });
119 fs.writeFileSync(toPath("fdc-test/connector/connector.yaml"), connectorYamlTemplate, {
120 mode: 420 /* 0o644 */,
121 });
122 return { serviceId, databaseId };
123}
124
125function prepareStep(step: Step) {
126 fs.writeFileSync(toPath("fdc-test/schema/schema.gql"), step.schemaGQL, { mode: 420 /* 0o644 */ });

Callers 1

tests.tsFile · 0.85

Calls 3

toPathFunction · 0.85
getRandomStringFunction · 0.70
toStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…