Skip to content

Commit 0e29a34

Browse files
authored
Fix some tests that were using real configstore content (#10178)
1 parent 81cbdec commit 0e29a34

3 files changed

Lines changed: 9 additions & 0 deletions

File tree

src/command.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { expect } from "chai";
22
import * as sinon from "sinon";
33
import * as rc from "./rc";
44
import * as nock from "nock";
5+
import { configstore } from "./configstore";
56

67
import { Command, validateProjectId } from "./command";
78
import { FirebaseError } from "./error";
@@ -34,14 +35,18 @@ describe("Command", () => {
3435

3536
describe("runner", () => {
3637
let rcStub: sinon.SinonStub;
38+
let configstoreStub: sinon.SinonStub;
39+
3740
beforeEach(() => {
41+
configstoreStub = sinon.stub(configstore, "get").returns({});
3842
rcStub = sinon
3943
.stub(rc, "loadRC")
4044
.returns(new rc.RC(undefined, { projects: { default: "default-project" } }));
4145
});
4246

4347
afterEach(() => {
4448
rcStub.restore();
49+
configstoreStub.restore();
4550
nock.cleanAll();
4651
});
4752

src/commands/firestore-operations-describe.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as fsi from "../firestore/api";
55
import { logger } from "../logger";
66
import { PrettyPrint } from "../firestore/pretty-print";
77
import { FirebaseError } from "../error";
8+
import { configstore } from "../configstore";
89

910
describe("firestore:operations:describe", () => {
1011
const sandbox = sinon.createSandbox();
@@ -13,6 +14,7 @@ describe("firestore:operations:describe", () => {
1314
let prettyPrintStub: sinon.SinonStub;
1415

1516
beforeEach(() => {
17+
sandbox.stub(configstore, "get").returns({});
1618
firestoreApiStub = sandbox.createStubInstance(fsi.FirestoreApi);
1719
sandbox.stub(fsi, "FirestoreApi").returns(firestoreApiStub);
1820
loggerInfoStub = sandbox.stub(logger, "info");

src/commands/firestore-operations-list.spec.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import * as fsi from "../firestore/api";
55
import { logger } from "../logger";
66
import { PrettyPrint } from "../firestore/pretty-print";
77
import { FirebaseError } from "../error";
8+
import { configstore } from "../configstore";
89

910
describe("firestore:operations:list", () => {
1011
const sandbox = sinon.createSandbox();
@@ -13,6 +14,7 @@ describe("firestore:operations:list", () => {
1314
let prettyPrintStub: sinon.SinonStub;
1415

1516
beforeEach(() => {
17+
sandbox.stub(configstore, "get").returns({});
1618
firestoreApiStub = sandbox.createStubInstance(fsi.FirestoreApi);
1719
sandbox.stub(fsi, "FirestoreApi").returns(firestoreApiStub);
1820
loggerInfoStub = sandbox.stub(logger, "info");

0 commit comments

Comments
 (0)