2828 * is refused at both keys, and Google filled in, or switched on over a
2929 * stored credential pair, in the same save as email and password off is
3030 * accepted;
31- * 7. a provider listed without a credential pair is no way in.
31+ * 7. a provider listed without a credential pair is no way in, and one the
32+ * boot did not declare counts only as the settings-added Google.
3233 */
3334
3435import { afterEach , beforeEach , describe , expect , it , vi } from 'vitest' ;
@@ -45,7 +46,7 @@ import {
4546import { AuthPlugin } from './auth-plugin.js' ;
4647import type { AuthManager } from './auth-manager.js' ;
4748import { SSO_PROVIDER_OBJECT } from './sso-client-secret.js' ;
48- import { SIGN_IN_FLOOR_COPY , providerCredentialIndex } from './sign-in-method-floor.js' ;
49+ import { SIGN_IN_FLOOR_COPY , providerCredentialIndex , providerCredentialsFrom } from './sign-in-method-floor.js' ;
4950
5051const SECRET = 'test-secret-at-least-32-chars-long' ;
5152
@@ -387,7 +388,7 @@ describe('the auth settings save keeps a way to sign in', () => {
387388 expect ( passwordOn ( manager ) ) . toBe ( true ) ;
388389 } ) ;
389390
390- it ( 'indexes each boot provider, social and OIDC, by whether it holds both credentials' , ( ) => {
391+ it ( 'indexes each boot provider, social and OIDC, by whether it holds both credentials; an unindexed one other than Google does not count ' , ( ) => {
391392 const index = providerCredentialIndex (
392393 { github : { clientId : 'id' , clientSecret : 'secret' } , gitlab : { clientId : 'id' , clientSecret : '' } } ,
393394 [ { providerId : 'okta' , clientId : 'id' , clientSecret : 'secret' } , { providerId : 'azure' , clientId : '' , clientSecret : 's' } ] ,
@@ -399,6 +400,14 @@ describe('the auth settings save keeps a way to sign in', () => {
399400 'oidc:azure' : false ,
400401 } ) ;
401402 expect ( providerCredentialIndex ( undefined , undefined ) . size ) . toBe ( 0 ) ;
403+
404+ // Outside the index only the settings-added social Google counts.
405+ const has = providerCredentialsFrom ( index ) ;
406+ expect ( has ( { id : 'gitlab' , type : 'social' } ) ) . toBe ( false ) ;
407+ expect ( has ( { id : 'google' , type : 'social' } ) ) . toBe ( true ) ;
408+ expect ( has ( { id : 'google' , type : 'oidc' } ) ) . toBe ( false ) ;
409+ expect ( has ( { id : 'bitbucket' , type : 'social' } ) ) . toBe ( false ) ;
410+ expect ( has ( { id : 'keycloak' , type : 'oidc' } ) ) . toBe ( false ) ;
402411 } ) ;
403412
404413 // ── 5. Recovery for a deployment that already stored the dead end ─────────
0 commit comments