Skip to content

Commit

Permalink
update snapshots
Browse files Browse the repository at this point in the history
  • Loading branch information
Popotojs committed Jun 29, 2024
1 parent 96ce394 commit e1c5db7
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 61 deletions.
16 changes: 8 additions & 8 deletions e2e/cats.e2e.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ xdescribe.each(testCase)("Module - %s", (_, dynamicModule) => {
afterEach(async () => {
return await axios
.delete(
"http://localhost:8080/emulator/v1/projects/demo-nhogs-nestjs-firebase/databases/(default)/documents"
"http://localhost:8080/emulator/v1/projects/demo-nhogs-nestjs-firebase/databases/(default)/documents",
)
.then(function (response) {
expect(response.status).toMatchInlineSnapshot(`200`);
Expand Down Expand Up @@ -112,7 +112,7 @@ xdescribe.each(testCase)("Module - %s", (_, dynamicModule) => {
"name": "Snowflake",
"url": "http://localhost:9199/v0/b/default-bucket/o/cats%2Fsnowflake.jpg?alt=media&token=1f6f9332-150b-4a91-80e7-8732ac84265e",
}
`
`,
);
done();
});
Expand All @@ -132,36 +132,36 @@ xdescribe.each(testCase)("Module - %s", (_, dynamicModule) => {
.expect(200)
.then((res) => {
expect(res.body).toMatchInlineSnapshot(`
Array [
Object {
[
{
"_id": "jellybean",
"age": 1,
"breed": "Birman",
"name": "Jellybean",
"url": "http://localhost:9199/v0/b/default-bucket/o/cats%2Fjellybean.jpg?alt=media&token=e56ec9d7-af49-4f67-af8c-e5cbf3ecfee9",
},
Object {
{
"_id": "marshmallow",
"age": 4,
"breed": "Bengal",
"name": "Marshmallow",
"url": "http://localhost:9199/v0/b/default-bucket/o/cats%2Fmarshmallow.jpg?alt=media&token=7a1dd7bf-7ca0-4f49-a56b-e8ef66dc985a",
},
Object {
{
"_id": "minnie",
"age": 2,
"breed": "Scottish Fold",
"name": "Minnie",
"url": "http://localhost:9199/v0/b/default-bucket/o/cats%2Fminnie.jpg?alt=media&token=d6d2d862-1739-47ef-82ec-7fdfee938766",
},
Object {
{
"_id": "puffin",
"age": 8,
"breed": "Siamese",
"name": "Puffin",
"url": "http://localhost:9199/v0/b/default-bucket/o/cats%2Fpuffin.jpg?alt=media&token=75095f8f-e184-44d9-bcbf-be1f467bd5e9",
},
Object {
{
"_id": "snowflake",
"age": 3,
"breed": "Maine coon",
Expand Down
12 changes: 6 additions & 6 deletions lib/service/auth/auth.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ describe("Firebase Auth Service", () => {
try {
await authService.signInWithEmailAndPassword(
"[email protected]",
"userpassword"
"userpassword",
);
} catch (error) {
expect(error).toMatchInlineSnapshot(
`[FirebaseError: Firebase: Error (auth/user-not-found).]`
`[FirebaseError: Firebase: Error (auth/user-not-found).]`,
);
}
});
Expand All @@ -51,7 +51,7 @@ describe("Firebase Auth Service", () => {
const user = (
await authService.createUserWithEmailAndPassword(
"[email protected]",
"userpassword"
"userpassword",
)
).user;

Expand All @@ -60,7 +60,7 @@ describe("Firebase Auth Service", () => {
const user2 = (
await authService.signInWithEmailAndPassword(
"[email protected]",
"userpassword"
"userpassword",
)
).user;

Expand All @@ -77,7 +77,7 @@ describe("Firebase Auth Service", () => {
},
};
expect(toCheck).toMatchInlineSnapshot(`
Object {
{
"operationType": "signIn",
"user": Object {
"isAnonymous": true,
Expand All @@ -98,7 +98,7 @@ describe("Firebase Auth Service", () => {
afterEach(async () => {
return await axios
.delete(
"http://localhost:9099/emulator/v1/projects/demo-nhogs-nestjs-firebase/accounts"
"http://localhost:9099/emulator/v1/projects/demo-nhogs-nestjs-firebase/accounts",
)
.then(function (response) {
expect(response.status).toMatchInlineSnapshot(`200`);
Expand Down
48 changes: 24 additions & 24 deletions lib/service/firestore/firestore.service.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -172,15 +172,15 @@ describe("Firebase Storage Service", () => {
.writeBatch()
.set(
firestoreService.doc("users", "1").withConverter<User>(userConverter),
u1
u1,
)
.set(
firestoreService.doc("users", "2").withConverter<User>(userConverter),
u2
u2,
)
.set(
firestoreService.doc("users", "3").withConverter<User>(userConverter),
u3
u3,
)
.commit();

Expand All @@ -192,9 +192,9 @@ describe("Firebase Storage Service", () => {
expect(
querySnapshot.docs
.map((value) => value.data())
.sort((a, b) => b.firstName.localeCompare(a.firstName))
.sort((a, b) => b.firstName.localeCompare(a.firstName)),
).toMatchInlineSnapshot(`
Array [
[
User {
"age": 3,
"firstName": "fn3",
Expand All @@ -218,15 +218,15 @@ describe("Firebase Storage Service", () => {
await firestoreService.runTransaction(async (transaction) => {
transaction.set(
firestoreService.doc("users", "1").withConverter<User>(userConverter),
u1
u1,
);
transaction.set(
firestoreService.doc("users", "2").withConverter<User>(userConverter),
u2
u2,
);
transaction.set(
firestoreService.doc("users", "3").withConverter<User>(userConverter),
u3
u3,
);
});

Expand All @@ -238,9 +238,9 @@ describe("Firebase Storage Service", () => {
expect(
querySnapshot.docs
.map((value) => value.data())
.sort((a, b) => b.firstName.localeCompare(a.firstName))
.sort((a, b) => b.firstName.localeCompare(a.firstName)),
).toMatchInlineSnapshot(`
Array [
[
User {
"age": 3,
"firstName": "fn3",
Expand Down Expand Up @@ -271,13 +271,13 @@ describe("Firebase Storage Service", () => {

const q = firestoreService.query(
users,
firestoreService.where("age", ">", 2)
firestoreService.where("age", ">", 2),
);

const querySnapshot = await firestoreService.getDocs(q);
expect(querySnapshot.docs.map((value) => value.data()))
.toMatchInlineSnapshot(`
Array [
[
User {
"age": 3,
"firstName": "fn3",
Expand All @@ -297,7 +297,7 @@ describe("Firebase Storage Service", () => {

const ref = await firestoreService.addDoc<UserWithId>(
users,
new UserWithId({ id: null, ...u1 })
new UserWithId({ id: null, ...u1 }),
);

const snapshot = await firestoreService.getDoc(ref);
Expand All @@ -312,7 +312,7 @@ describe("Firebase Storage Service", () => {
"id": Any<String>,
"lastName": "ln1",
}
`
`,
);

expect(data.id).not.toBeNull();
Expand All @@ -326,7 +326,7 @@ describe("Firebase Storage Service", () => {
for (let i = 0; i < 25; i++) {
await firestoreService.addDoc<User>(
users,
new User("fn" + i, "ln" + i, i)
new User("fn" + i, "ln" + i, i),
);
}

Expand All @@ -335,13 +335,13 @@ describe("Firebase Storage Service", () => {
firestoreService.orderBy("age", "desc"),
firestoreService.startAt(9),
firestoreService.endAt(7),
firestoreService.limit(2)
firestoreService.limit(2),
);

const querySnapshot1 = await firestoreService.getDocs(q1);
expect(querySnapshot1.docs.map((value) => value.data()))
.toMatchInlineSnapshot(`
Array [
[
User {
"age": 9,
"firstName": "fn9",
Expand All @@ -359,13 +359,13 @@ describe("Firebase Storage Service", () => {
users,
firestoreService.orderBy("firstName"),
firestoreService.startAfter("fn3"),
firestoreService.endBefore("fn7")
firestoreService.endBefore("fn7"),
);

const querySnapshot2 = await firestoreService.getDocs(q2);
expect(querySnapshot2.docs.map((value) => value.data()))
.toMatchInlineSnapshot(`
Array [
[
User {
"age": 4,
"firstName": "fn4",
Expand Down Expand Up @@ -393,13 +393,13 @@ describe("Firebase Storage Service", () => {
for (let i = 3; i >= 0; i--) {
await firestoreService.addDoc<User>(
users,
new User("fn" + i, "ln" + i, i)
new User("fn" + i, "ln" + i, i),
);
}

const q1 = firestoreService.query(
users,
firestoreService.orderBy(firestoreService.documentId())
firestoreService.orderBy(firestoreService.documentId()),
);

const querySnapshot1 = await firestoreService.getDocs(q1);
Expand All @@ -421,12 +421,12 @@ describe("Firebase Storage Service", () => {

const q = firestoreService.query(
docs,
firestoreService.orderBy("time", "desc")
firestoreService.orderBy("time", "desc"),
);

const snap = await firestoreService.getDocs(q);
expect(snap.docs.map((d) => d.data().index)).toMatchInlineSnapshot(`
Array [
[
0,
1,
2,
Expand All @@ -439,7 +439,7 @@ describe("Firebase Storage Service", () => {
// Delete all documents
return await axios
.delete(
`http://${FirebaseEmulatorEnv.firestoreHost}:${FirebaseEmulatorEnv.firestorePort}/emulator/v1/projects/${FirebaseEmulatorEnv.projectId}/databases/(default)/documents`
`http://${FirebaseEmulatorEnv.firestoreHost}:${FirebaseEmulatorEnv.firestorePort}/emulator/v1/projects/${FirebaseEmulatorEnv.projectId}/databases/(default)/documents`,
)
.then(function (response) {
expect(response.status).toMatchInlineSnapshot(`200`);
Expand Down
Loading

0 comments on commit e1c5db7

Please sign in to comment.