Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 18 additions & 22 deletions test/integration/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2398,30 +2398,26 @@ describe('admin.auth', () => {
});
});

it('deleteTenant() should successfully delete the provided tenant', () => {
const allTenantIds: string[] = [];
const listAllTenantIds = (tenantIds: string[], nextPageToken?: string): Promise<void> => {
return getAuth().tenantManager().listTenants(100, nextPageToken)
.then((result) => {
result.tenants.forEach((tenant) => {
tenantIds.push(tenant.tenantId);
});
if (result.pageToken) {
return listAllTenantIds(tenantIds, result.pageToken);
}
describe('tenant deletion operations', () => {
it('deleteTenant() should successfully delete the provided tenant', async () => {
const allTenantIds: string[] = [];
const listAllTenantIds = async (tenantIds: string[], nextPageToken?: string): Promise<void> => {
const result = await getAuth().tenantManager().listTenants(100, nextPageToken);
result.tenants.forEach((tenant) => {
tenantIds.push(tenant.tenantId);
});
};
if (result.pageToken) {
await listAllTenantIds(tenantIds, result.pageToken);
}
};

return getAuth().tenantManager().deleteTenant(createdTenantId)
.then(() => {
// Use listTenants() instead of getTenant() to check that the tenant
// is no longer present, because Auth Emulator implicitly creates the
// tenant in getTenant() when it is not found
return listAllTenantIds(allTenantIds);
})
.then(() => {
expect(allTenantIds).to.not.contain(createdTenantId);
});
await getAuth().tenantManager().deleteTenant(createdTenantId);
// Use listTenants() instead of getTenant() to check that the tenant
// is no longer present, because Auth Emulator implicitly creates the
// tenant in getTenant() when it is not found
await listAllTenantIds(allTenantIds);
expect(allTenantIds).to.not.contain(createdTenantId);
});
});
});

Expand Down
Loading