Skip to content

Commit

Permalink
updated based upon use of modules.exports = syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
garyhuntddn committed Feb 21, 2022
1 parent d3d6c9a commit cb99981
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
4 changes: 4 additions & 0 deletions service/authentication/AuthenticationEvents.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ describe( "/service/authentication/AuthenticationEvents members", () => {
const {
IDENTITY_UPDATED,
AuthenticationEvents,
default: AuthenticationEventsDefault,
...others
} = exported as any; // TODO: remove cast after typescript conversion

Expand All @@ -14,6 +15,9 @@ describe( "/service/authentication/AuthenticationEvents members", () => {
if ( AuthenticationEvents ) {
expect( AuthenticationEvents.IDENTITY_UPDATED ).toBe( 'authentication.identity_updated' );
}
if ( AuthenticationEventsDefault ) {
expect( AuthenticationEventsDefault.IDENTITY_UPDATED ).toBe( 'authentication.identity_updated' );
}
} );

it( "unknown members", () => {
Expand Down
7 changes: 6 additions & 1 deletion service/authentication/AuthenticationEvents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
enum AuthenticationEvents {
export enum AuthenticationEvents {
/**
* Event callback arguments:
* function(authenticationEnabled, userIdentity)
Expand All @@ -10,4 +10,9 @@ enum AuthenticationEvents {
IDENTITY_UPDATED = 'authentication.identity_updated'
};

export const IDENTITY_UPDATED = AuthenticationEvents.IDENTITY_UPDATED;

// TODO: this was a pre-ES6 module using module.exports = AuthenticationEvents which doesn't translate well
// it is used in a number of places and should be updated to use the named export

export default AuthenticationEvents;
14 changes: 13 additions & 1 deletion types/auto/service/authentication/AuthenticationEvents.d.ts
Original file line number Diff line number Diff line change
@@ -1 +1,13 @@
export const IDENTITY_UPDATED: string;
export declare enum AuthenticationEvents {
/**
* Event callback arguments:
* function(authenticationEnabled, userIdentity)
* authenticationEnabled - indicates whether authentication has been enabled
* in this session
* userIdentity - if user has been logged in then it contains user name. If
* contains 'null' or 'undefined' then user is not logged in.
*/
IDENTITY_UPDATED = "authentication.identity_updated"
}
export declare const IDENTITY_UPDATED = AuthenticationEvents.IDENTITY_UPDATED;
export default AuthenticationEvents;

0 comments on commit cb99981

Please sign in to comment.