Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding integration tests #2340

Open
wants to merge 4 commits into
base: passkeys
Choose a base branch
from
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
44 changes: 42 additions & 2 deletions test/integration/auth.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1222,7 +1222,7 @@ describe('admin.auth', () => {
minLength: 6,
}
}
})
})
});

const mfaSmsEnabledTotpEnabledConfig: MultiFactorConfig = {
Expand Down Expand Up @@ -1758,6 +1758,46 @@ describe('admin.auth', () => {
});
});

describe('Passkey config management operations', () => {
Xiaoshouzi-gh marked this conversation as resolved.
Show resolved Hide resolved

// Define expected passkey configuration
const expectedPasskeyConfig = {
name: 'projects/{$projectId}/passkeyConfig',
rpId: '{$projectId}.firebaseapp.com',
expectedOrigins: ['app1', 'example.com'],
};

it('createPasskeyConfig() should create passkey config with expected passkeyConfig', async () => {
const rpId = projectId + '.firebaseapp.com';
const createRequest = { expectedOrigins: ['app1', 'example.com'] };
const createdPasskeyConfig = await getAuth().passkeyConfigManager().createPasskeyConfig(rpId, createRequest);

expect(createdPasskeyConfig.name).to.deep.equal(expectedPasskeyConfig.name);
expect(createdPasskeyConfig.rpId).to.deep.equal(expectedPasskeyConfig.rpId);
expect(createdPasskeyConfig.expectedOrigins).to.deep.equal(expectedPasskeyConfig.expectedOrigins);
});

it('getPasskeyConfig() should resolve with expected passkeyConfig', async () => {
const actualPasskeyConfig = await getAuth().passkeyConfigManager().getPasskeyConfig();

expect(actualPasskeyConfig.name).to.deep.equal(expectedPasskeyConfig.name);
expect(actualPasskeyConfig.rpId).to.deep.equal(expectedPasskeyConfig.rpId);
expect(actualPasskeyConfig.expectedOrigins).to.deep.equal(expectedPasskeyConfig.rpId);
});

it('updatePasskeyConfig() should resolve with updated expectedOrigins', async () => {
const updateRequest = {
expectedOrigins: ['app1', 'example.com', 'app2']
};

const updatedPasskeyConfig = await getAuth().passkeyConfigManager().updatePasskeyConfig(updateRequest);

expect(updatedPasskeyConfig.name).to.deep.equal(expectedPasskeyConfig.name);
expect(updatedPasskeyConfig.rpId).to.deep.equal(expectedPasskeyConfig.rpId);
expect(updatedPasskeyConfig.expectedOrigins).to.deep.equal(updateRequest.expectedOrigins);
});
});

// Sanity check OIDC/SAML config management API.
describe('SAML management APIs', () => {
let tenantAwareAuth: TenantAwareAuth;
Expand Down Expand Up @@ -2022,7 +2062,7 @@ describe('admin.auth', () => {
}
return getAuth().tenantManager().updateTenant(createdTenantId, updateRequestNoMfaConfig)
});

it('updateTenant() should not update tenant reCAPTCHA config is undefined', () => {
expectedUpdatedTenant.tenantId = createdTenantId;
const updatedOptions2: UpdateTenantRequest = {
Expand Down
Loading