-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
4,149 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import { LoadTestConfig } from "@/app/config"; | ||
import { LoadTestClient } from "@/load-test"; | ||
import * as E from "fp-ts/lib/Either"; | ||
import * as O from "fp-ts/lib/Option"; | ||
import * as RA from "fp-ts/lib/ReadonlyArray"; | ||
import { pipe } from "fp-ts/lib/function"; | ||
import { PdvTokenizerClient } from "io-wallet-common/infra/pdv-tokenizer/client"; | ||
import { User } from "io-wallet-common/user"; | ||
|
||
export class IoLoadTestClient implements LoadTestClient { | ||
#users: string[]; | ||
|
||
isTestUser = (user: User) => | ||
pipe( | ||
this.#users, | ||
RA.findFirst((userId) => userId === user.id), | ||
O.isSome, | ||
E.right, | ||
); | ||
|
||
//Since it is necessary to have the list of users already processed at startup in the constructor, a functional approach is not used. | ||
constructor( | ||
{ testUsersFiscalCode }: LoadTestConfig, | ||
pdvTokenizerClient: PdvTokenizerClient, | ||
) { | ||
const users: string[] = []; | ||
testUsersFiscalCode.forEach((fiscalCode) => | ||
pdvTokenizerClient | ||
.getOrCreateUserByFiscalCode(fiscalCode)() | ||
.then((result) => { | ||
if (result._tag === "Right") { | ||
const fiscalCodesTokens = result.right; | ||
users.push(fiscalCodesTokens.id); | ||
} | ||
}), | ||
); | ||
|
||
this.#users = users; | ||
} | ||
} |
Oops, something went wrong.