Skip to content

Commit b26b87f

Browse files
committed
trying to integrate test
1 parent 248059d commit b26b87f

File tree

4 files changed

+111
-13
lines changed

4 files changed

+111
-13
lines changed

database-debug.log

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
22
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by akka.util.Unsafe (file:/Users/stephenarosaj/.cache/firebase/emulators/firebase-database-emulator-v4.11.2.jar)
33
WARNING: Please consider reporting this to the maintainers of class akka.util.Unsafe
44
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
5-
16:49:54.775 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
6-
16:49:54.866 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000
7-
16:50:04.160 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO com.firebase.core.namespace.NamespaceActor - fake-project-id successfully activated FBKV (SurveyIdle(0)) wait: 86ms, init: 0ms
8-
16:50:05.737 [Thread-0] INFO com.firebase.server.forge.App$ - Attempting graceful shutdown.
9-
16:50:05.747 [NamespaceSystem-akka.actor.default-dispatcher-9] INFO com.firebase.core.namespace.Terminator$Terminator - 1 actors left to terminate: fake-project-id
10-
16:50:05.751 [NamespaceSystem-akka.actor.default-dispatcher-10] INFO com.firebase.core.namespace.NamespaceActor - stopped namespace actor for fake-project-id
11-
16:50:05.754 [Thread-0] INFO com.firebase.server.forge.App$ - Graceful shutdown complete.
5+
10:00:38.210 [NamespaceSystem-akka.actor.default-dispatcher-4] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
6+
10:00:38.292 [main] INFO com.firebase.server.forge.App$ - Listening at 127.0.0.1:9000
7+
10:00:42.038 [Thread-0] INFO com.firebase.server.forge.App$ - Attempting graceful shutdown.
8+
10:00:42.047 [Thread-0] INFO com.firebase.server.forge.App$ - Graceful shutdown complete.

firestore-debug.log

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ WARNING: A terminally deprecated method in sun.misc.Unsafe has been called
22
WARNING: sun.misc.Unsafe::objectFieldOffset has been called by io.netty.util.internal.PlatformDependent0$4 (file:/Users/stephenarosaj/.cache/firebase/emulators/cloud-firestore-emulator-v1.19.8.jar)
33
WARNING: Please consider reporting this to the maintainers of class io.netty.util.internal.PlatformDependent0$4
44
WARNING: sun.misc.Unsafe::objectFieldOffset will be removed in a future release
5-
Aug 19, 2025 4:49:53 PM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start
5+
Sep 03, 2025 10:00:37 AM com.google.cloud.datastore.emulator.firestore.websocket.WebSocketServer start
66
INFO: Started WebSocket server on ws://127.0.0.1:9150
77
API endpoint: http://127.0.0.1:8080
88
If you are using a library that supports the FIRESTORE_EMULATOR_HOST environment variable, run:
@@ -16,7 +16,5 @@ If you are running a Firestore in Datastore Mode project, run:
1616
Note: Support for Datastore Mode is in preview. If you encounter any bugs please file at https://github.com/firebase/firebase-tools/issues.
1717
Dev App Server is now running.
1818

19-
Aug 19, 2025 4:50:04 PM io.gapi.emulators.netty.HttpVersionRoutingHandler channelRead
20-
INFO: Detected HTTP/2 connection.
2119
*** shutting down gRPC server since JVM is shutting down
2220
*** server shut down

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/integration/data-connect.spec.ts

Lines changed: 104 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ describe('getDataConnect()', () => {
244244
});
245245
});
246246

247-
describe('Impersonation', () => {
247+
describe('executeGraphql* Impersonation', () => {
248248
const optsAuthorizedFredClaims: GraphqlOptions<undefined> = {
249249
impersonate: {
250250
authClaims: {
@@ -387,4 +387,107 @@ describe('getDataConnect()', () => {
387387
});
388388
});
389389
});
390+
391+
// describe('impersonateQuery()', () => {
392+
// const impersonateConnectorConfig: ConnectorConfig = { ...connectorConfig, connector: 'my-connector' };
393+
// describe('with unauthenticated impersonation', () => {
394+
// const optsUnauthorizedClaims: GraphqlOptions<undefined> = {
395+
// impersonate: {
396+
// unauthenticated: true
397+
// }
398+
// };
399+
400+
// it('should successfully execute a query with @auth(level: PUBLIC)', () => {
401+
// return getDataConnect(impersonateConnectorConfig).impersonateQuery({})
402+
// .should.eventually.be.rejected.and.have.property('code', 'data-connect/permission-denied');
403+
404+
// });
405+
// it('should successfully execute a query with @auth(level: NO_ACCESS)', () => {});
406+
// it('should fail to successfully execute a query with @auth(level: USER)', () => {});
407+
// it('should fail to successfully execute a query with @auth(level: USER_ANON)', () => {});
408+
// it('should fail to successfully execute a query with @auth(level: USER_EMAIL_VERIFIED)', () => {});
409+
// });
410+
// describe('with authenticated impersonation', () => {
411+
// const optsAuthorizedClaims: GraphqlOptions<undefined> = {
412+
// impersonate: {
413+
// authClaims: {
414+
// sub: userId,
415+
// email_verified: true,
416+
// firebase: {
417+
// identities: { who: 'me' },
418+
// sign_in_provider: 'google.com'
419+
// }
420+
// }
421+
// }
422+
// };
423+
// const optsNonExistingClaims: GraphqlOptions<undefined> = {
424+
// impersonate: {
425+
// authClaims: {
426+
// sub: 'non-exisiting-id',
427+
// email_verified: true,
428+
// firebase: {
429+
// identities: { who: 'me' },
430+
// sign_in_provider: 'google.com'
431+
// }
432+
// }
433+
// }
434+
// };
435+
// const optsAnonymousClaims: GraphqlOptions<undefined> = {
436+
// impersonate: {
437+
// authClaims: {
438+
// sub: userId,
439+
// email_verified: true,
440+
// firebase: {
441+
// identities: { who: 'me' },
442+
// sign_in_provider: 'anonymous'
443+
// }
444+
// }
445+
// }
446+
// };
447+
// const optsUnverifiedClaims: GraphqlOptions<undefined> = {
448+
// impersonate: {
449+
// authClaims: {
450+
// sub: 'non-exisiting-id',
451+
// email_verified: false
452+
// }
453+
// }
454+
// };
455+
// it('should successfully execute a query with @auth(level: PUBLIC)', () => {});
456+
// it('should successfully execute a query with @auth(level: NO_ACCESS)', () => {});
457+
// it('should successfully execute a query with @auth(level: USER) \
458+
// if the impersonated user is not anonymous', () => {});
459+
// it('should fail to successfully execute a query with @auth(level: USER) \
460+
// if the impersonated user is anonymous', () => {});
461+
// it('should successfully execute a query with @auth(level: USER_ANON)', () => {});
462+
// it('should successfully execute a query with @auth(level: USER_EMAIL_VERIFIED) \
463+
// if the impersonated user has their email verified', () => {});
464+
// it('should fail to successfully execute a query with @auth(level: USER_EMAIL_VERIFIED) \
465+
// if the impersonated user does not have email verified', () => {});
466+
// it("should grab the impersonated user's data", () => {});
467+
// });
468+
// });
469+
470+
// describe('impersonateMutation()', () => {
471+
// describe('with unauthenticated impersonation', () => {
472+
// it('should successfully execute a mutation with @auth(level: PUBLIC)', () => {});
473+
// it('should successfully execute a mutation with @auth(level: NO_ACCESS)', () => {});
474+
// it('should fail to successfully execute a mutation with @auth(level: USER)', () => {});
475+
// it('should fail to successfully execute a mutation with @auth(level: USER_ANON)', () => {});
476+
// it('should fail to successfully execute a mutation with @auth(level: USER_EMAIL_VERIFIED)', () => {});
477+
// });
478+
// describe('with authenticated impersonation', () => {
479+
// it('should successfully execute a mutation with @auth(level: PUBLIC)', () => {});
480+
// it('should successfully execute a mutation with @auth(level: NO_ACCESS)', () => {});
481+
// it('should successfully execute a mutation with @auth(level: USER) \
482+
// if the impersonated user is not anonymous', () => {});
483+
// it('should fail to successfully execute a mutation with @auth(level: USER) \
484+
// if the impersonated user is anonymous', () => {});
485+
// it('should successfully execute a mutation with @auth(level: USER_ANON)', () => {});
486+
// it('should successfully execute a mutation with @auth(level: USER_EMAIL_VERIFIED) \
487+
// if the impersonated user has their email verified', () => {});
488+
// it('should fail to successfully execute a mutation with @auth(level: USER_EMAIL_VERIFIED) \
489+
// if the impersonated user does not have email verified', () => {});
490+
// it("should grab the impersonated user's data", () => {});
491+
// });
492+
// });
390493
});

0 commit comments

Comments
 (0)