Skip to content

Commit

Permalink
feat: test cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rushtong committed Sep 14, 2024
1 parent 1c1288b commit e100a0f
Showing 1 changed file with 3 additions and 23 deletions.
26 changes: 3 additions & 23 deletions cypress/component/SignIn/sign_in_button.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,30 +9,10 @@ import {Storage} from '../../../src/libs/storage';
import {Metrics} from '../../../src/libs/ajax/Metrics';
import {StackdriverReporter} from '../../../src/libs/stackdriverReporter';
import {ToS} from '../../../src/libs/ajax/ToS';
import {oidcUser} from '../Auth/oidcUser';

const signInText = 'Sign In';

const claims = {
jti: undefined, nbf: undefined, sub: undefined,
iss: '',
aud: '',
exp: 0,
iat: 0
};

const user = {
access_token: '', get expires_in() {
return undefined;
}, session_state: undefined, state: undefined, token_type: '', get expired() {
return undefined;
}, get scopes() {
return [];
}, toStorageString() {
return '';
},
profile: claims
};

const duosUser = {
displayName: 'display name',
email: '[email protected]',
Expand All @@ -59,7 +39,7 @@ describe('Sign In: Component Loads', function() {

it('Sign In: On Success', function () {
cy.viewport(600, 300);
cy.stub(Auth, 'signIn').returns(Promise.resolve(user));
cy.stub(Auth, 'signIn').returns(Promise.resolve(oidcUser));
cy.stub(User, 'getMe').returns(duosUser);
cy.stub(StackdriverReporter, 'report');
cy.stub(Metrics, 'identify');
Expand All @@ -80,7 +60,7 @@ describe('Sign In: Component Loads', function() {
it('Sign In: No Roles Error Reporter Is Called', function () {
const bareUser = {email: '[email protected]'};
cy.viewport(600, 300);
cy.stub(Auth, 'signIn').returns(Promise.resolve(user));
cy.stub(Auth, 'signIn').returns(Promise.resolve(oidcUser));
cy.stub(User, 'getMe').returns(bareUser);
cy.stub(StackdriverReporter, 'report');
cy.stub(Metrics, 'identify');
Expand Down

0 comments on commit e100a0f

Please sign in to comment.