-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve tests speed by reducing setup
improved test speed by ~35% on my machine
- Loading branch information
Showing
5 changed files
with
27 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -23,21 +23,11 @@ internal class Bans | |
private static User s_normalUser = null!; | ||
|
||
[OneTimeSetUp] | ||
public void OneTimeSetup() | ||
public async Task OneTimeSetup() | ||
{ | ||
s_factory = new(); | ||
s_apiClient = s_factory.CreateTestApiClient(); | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void OneTimeTeardown() | ||
{ | ||
s_factory.Dispose(); | ||
} | ||
|
||
[SetUp] | ||
public async Task SetUp() | ||
{ | ||
s_factory.ResetDatabase(); | ||
|
||
s_adminJwt = (await s_apiClient.LoginAdminUser()).Token; | ||
|
@@ -74,6 +64,12 @@ await s_apiClient.Post<Modship>( | |
s_modJwt = (await s_apiClient.LoginUser("[email protected]", "Passw0rd!")).Token; | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void OneTimeTeardown() | ||
{ | ||
s_factory.Dispose(); | ||
} | ||
|
||
[Test] | ||
public static async Task CreateSiteBan_Ok() | ||
{ | ||
|
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 |
---|---|---|
|
@@ -25,21 +25,11 @@ internal class Judgements | |
private const string VALID_EMAIL = "[email protected]"; | ||
|
||
[OneTimeSetUp] | ||
public void OneTimeSetup() | ||
public async Task OneTimeSetup() | ||
{ | ||
s_factory = new TestApiFactory(); | ||
s_apiClient = s_factory.CreateTestApiClient(); | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void OneTimeTearDown() | ||
{ | ||
s_factory.Dispose(); | ||
} | ||
|
||
[SetUp] | ||
public async Task SetUp() | ||
{ | ||
s_factory.ResetDatabase(); | ||
|
||
// Set up a default Leaderboard and a mod user for that leaderboard to use as the Jwt for | ||
|
@@ -89,6 +79,12 @@ public async Task SetUp() | |
s_jwt = (await s_apiClient.LoginUser(VALID_EMAIL, VALID_PASSWORD)).Token; | ||
} | ||
|
||
[OneTimeTearDown] | ||
public void OneTimeTearDown() | ||
{ | ||
s_factory.Dispose(); | ||
} | ||
|
||
[Test] | ||
public async Task CreateJudgement_OK() | ||
{ | ||
|
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