-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from thdk/chore/upgrade-firebase
Chore/upgrade firebase
- Loading branch information
Showing
23 changed files
with
1,608 additions
and
1,097 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,42 @@ | ||
import { initializeTestEnvironment, RulesTestEnvironment } from "@firebase/rules-unit-testing"; | ||
import { Collection } from "../.."; | ||
|
||
import { initTestFirestore } from "../../../utils/test-firestore"; | ||
|
||
const { | ||
firestore, | ||
} = initTestFirestore( | ||
"test-constructor-collection", | ||
["books"], | ||
); | ||
import { FirebaseFirestore } from "@firebase/firestore-types"; | ||
import { collection } from "firebase/firestore"; | ||
|
||
const projectId = "test-constructor-collection"; | ||
describe("Collection.constructor", () => { | ||
let firestore: FirebaseFirestore; | ||
let testEnv: RulesTestEnvironment; | ||
|
||
beforeAll(async () => { | ||
testEnv = await initializeTestEnvironment({ | ||
projectId, | ||
firestore: { | ||
host: "localhost", | ||
port: 8080, | ||
} | ||
}); | ||
|
||
firestore = testEnv.unauthenticatedContext().firestore(); | ||
}); | ||
|
||
afterAll(() => testEnv.cleanup()); | ||
test("it should create a Collection instance with a string as collectionRef", () => { | ||
const collection = new Collection(firestore, "books"); | ||
|
||
expect(collection).toBeInstanceOf(Collection); | ||
}); | ||
|
||
test("it should create a Collection instance with a function as collectionRef", () => { | ||
const collection = new Collection(firestore, () => firestore.collection("books")); | ||
const booksCollection = new Collection(firestore, () => collection(firestore, "books")); | ||
|
||
expect(collection).toBeInstanceOf(Collection); | ||
expect(booksCollection).toBeInstanceOf(Collection); | ||
}); | ||
|
||
test("it should create a Collection instance with a CollectionReference as collectionRef", () => { | ||
const collection = new Collection(firestore, firestore.collection("books")); | ||
const booksCollection = new Collection(firestore, collection(firestore, "books")); | ||
|
||
expect(collection).toBeInstanceOf(Collection); | ||
expect(booksCollection).toBeInstanceOf(Collection); | ||
}); | ||
}); |
Oops, something went wrong.