-
Notifications
You must be signed in to change notification settings - Fork 990
/
Copy pathfunctionsConfig.spec.ts
44 lines (38 loc) · 1.19 KB
/
functionsConfig.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { expect } from "chai";
import * as functionsConfig from "./functionsConfig";
describe("config.parseSetArgs", () => {
it("should throw if a reserved namespace is used", () => {
expect(() => {
functionsConfig.parseSetArgs(["firebase.something=else"]);
}).to.throw("reserved namespace");
});
it("should throw if a malformed arg is used", () => {
expect(() => {
functionsConfig.parseSetArgs(["foo.bar=baz", "qux"]);
}).to.throw("must be in key=val format");
});
it("should parse args into correct config and variable IDs", () => {
expect(functionsConfig.parseSetArgs(["foo.bar.faz=val"])).to.deep.eq([
{
configId: "foo",
varId: "bar/faz",
val: "val",
},
]);
});
});
describe("config.parseUnsetArgs", () => {
it("should throw if a reserved namespace is used", () => {
expect(() => {
functionsConfig.parseUnsetArgs(["firebase.something"]);
}).to.throw("reserved namespace");
});
it("should parse args into correct config and variable IDs", () => {
expect(functionsConfig.parseUnsetArgs(["foo.bar.faz"])).to.deep.eq([
{
configId: "foo",
varId: "bar/faz",
},
]);
});
});