mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 22:54:42 -04:00
feat(test-setup): restructure to synchronous builder
The previous pattern used async methods for the builder pattern, which were hideous to use when chained multiple times. This extracts the builder into a separate class and uses normal functions in the builder. These queue async functions in arrays, which are executed at the correct time, when the new async `build` function is called. Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
8f1aeab934
commit
d1dbd1bb22
13 changed files with 156 additions and 84 deletions
|
@ -17,7 +17,7 @@ import { UpdatePasswordDto } from '../../src/identity/local/update-password.dto'
|
|||
import { UserRelationEnum } from '../../src/users/user-relation.enum';
|
||||
import { checkPassword } from '../../src/utils/password';
|
||||
import { setupSessionMiddleware } from '../../src/utils/session';
|
||||
import { TestSetup } from '../test-setup';
|
||||
import { TestSetup, TestSetupBuilder } from '../test-setup';
|
||||
|
||||
describe('Auth', () => {
|
||||
let testSetup: TestSetup;
|
||||
|
@ -27,7 +27,7 @@ describe('Auth', () => {
|
|||
let password: string;
|
||||
|
||||
beforeAll(async () => {
|
||||
testSetup = await TestSetup.create();
|
||||
testSetup = await TestSetupBuilder.create().build();
|
||||
|
||||
const authConfig = testSetup.configService.get('authConfig') as AuthConfig;
|
||||
setupSessionMiddleware(testSetup.app, authConfig);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue