Skip to content

Commit

Permalink
fix test data
Browse files Browse the repository at this point in the history
  • Loading branch information
anish749 authored and eandre committed Feb 12, 2024
1 parent 5684d64 commit ab06d3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
4 changes: 2 additions & 2 deletions internal/clientgen/testdata/expected_javascript.js
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class BaseClient {
if (typeof auth === "function") {
this.authGenerator = auth
} else {
this.authGenerator = () => auth
this.authGenerator = () => Promise.resolve(auth)
}
}

Expand All @@ -311,7 +311,7 @@ class BaseClient {
// If authorization data generator is present, call it and add the returned data to the request
let authData
if (this.authGenerator) {
authData = this.authGenerator()
authData = await this.authGenerator()
}

// If we now have authentication data, add it to the request
Expand Down
9 changes: 6 additions & 3 deletions internal/clientgen/testdata/expected_typescript.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,7 +440,10 @@ type CallParameters = Omit<RequestInit, "method" | "body" | "headers"> & {
}

// AuthDataGenerator is a function that returns a new instance of the authentication data required by this API
export type AuthDataGenerator = () => (authentication.AuthData | undefined)
export type AuthDataGenerator = () =>
| authentication.AuthData
| undefined
| Promise<authentication.AuthData | undefined>;

// A fetcher is the prototype for the inbuilt Fetch function
export type Fetcher = typeof fetch;
Expand Down Expand Up @@ -475,7 +478,7 @@ class BaseClient {
if (typeof auth === "function") {
this.authGenerator = auth
} else {
this.authGenerator = () => auth
this.authGenerator = () => Promise.resolve(auth)
}
}

Expand All @@ -497,7 +500,7 @@ class BaseClient {
// If authorization data generator is present, call it and add the returned data to the request
let authData: authentication.AuthData | undefined
if (this.authGenerator) {
authData = this.authGenerator()
authData = await this.authGenerator()
}

// If we now have authentication data, add it to the request
Expand Down

0 comments on commit ab06d3d

Please sign in to comment.