Skip to content

Commit 2b042aa

Browse files
committed
cleaned up branch, moved integration tests over from stephenarosaj/fdc-integration-tests - ready to add new impersonate api integration tests
1 parent 4ef3748 commit 2b042aa

File tree

1 file changed

+73
-1
lines changed

1 file changed

+73
-1
lines changed

test/integration/data-connect.spec.ts

Lines changed: 73 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,5 +387,77 @@ describe('getDataConnect()', () => {
387387
});
388388
});
389389
});
390-
});
390+
describe('impersonateQuery()', () => {
391+
const impersonateConnectorConfig: ConnectorConfig = { ...connectorConfig, connector: 'my-connector' };
392+
describe('with unauthenticated impersonation', () => {
393+
it('should successfully execute a query with @auth(level: PUBLIC)', () => {
394+
return getDataConnect(impersonateConnectorConfig).impersonateQuery({})
395+
.should.eventually.be.rejected.and.have.property('code', 'data-connect/permission-denied');
396+
});
397+
398+
it('should successfully execute a query with @auth(level: NO_ACCESS)', () => {});
399+
400+
it('should fail to successfully execute a query with @auth(level: USER)', () => {});
401+
402+
it('should fail to successfully execute a query with @auth(level: USER_ANON)', () => {});
403+
404+
it('should fail to successfully execute a query with @auth(level: USER_EMAIL_VERIFIED)', () => {});
405+
});
406+
describe('with authenticated impersonation', () => {
407+
it('should successfully execute a query with @auth(level: PUBLIC)', () => {});
408+
409+
it('should successfully execute a query with @auth(level: NO_ACCESS)', () => {});
410+
411+
it('should successfully execute a query with @auth(level: USER) \
412+
if the impersonated user is not anonymous', () => {});
413+
414+
it('should fail to successfully execute a query with @auth(level: USER) \
415+
if the impersonated user is anonymous', () => {});
416+
417+
it('should successfully execute a query with @auth(level: USER_ANON)', () => {});
418+
419+
it('should successfully execute a query with @auth(level: USER_EMAIL_VERIFIED) \
420+
if the impersonated user has their email verified', () => {});
421+
422+
it('should fail to successfully execute a query with @auth(level: USER_EMAIL_VERIFIED) \
423+
if the impersonated user does not have email verified', () => {});
424+
425+
it("should grab the impersonated user's data", () => {});
426+
});
427+
});
391428

429+
describe('impersonateMutation()', () => {
430+
describe('with unauthenticated impersonation', () => {
431+
it('should successfully execute a mutation with @auth(level: PUBLIC)', () => {});
432+
433+
it('should successfully execute a mutation with @auth(level: NO_ACCESS)', () => {});
434+
435+
it('should fail to successfully execute a mutation with @auth(level: USER)', () => {});
436+
437+
it('should fail to successfully execute a mutation with @auth(level: USER_ANON)', () => {});
438+
439+
it('should fail to successfully execute a mutation with @auth(level: USER_EMAIL_VERIFIED)', () => {});
440+
});
441+
describe('with authenticated impersonation', () => {
442+
it('should successfully execute a mutation with @auth(level: PUBLIC)', () => {});
443+
444+
it('should successfully execute a mutation with @auth(level: NO_ACCESS)', () => {});
445+
446+
it('should successfully execute a mutation with @auth(level: USER) \
447+
if the impersonated user is not anonymous', () => {});
448+
449+
it('should fail to successfully execute a mutation with @auth(level: USER) \
450+
if the impersonated user is anonymous', () => {});
451+
452+
it('should successfully execute a mutation with @auth(level: USER_ANON)', () => {});
453+
454+
it('should successfully execute a mutation with @auth(level: USER_EMAIL_VERIFIED) \
455+
if the impersonated user has their email verified', () => {});
456+
457+
it('should fail to successfully execute a mutation with @auth(level: USER_EMAIL_VERIFIED) \
458+
if the impersonated user does not have email verified', () => {});
459+
460+
it("should grab the impersonated user's data", () => {});
461+
});
462+
});
463+
});

0 commit comments

Comments
 (0)