Skip to content

Commit 4b841a0

Browse files
committed
Update e2e test helper createRootDirectory to use Session ALS
1 parent 74b9dc4 commit 4b841a0

File tree

3 files changed

+13
-14
lines changed

3 files changed

+13
-14
lines changed

src/components/file/file.repository.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -399,13 +399,11 @@ export class FileRepository extends CommonRepository {
399399
relation,
400400
name,
401401
public: isPublic,
402-
session,
403402
}: {
404403
resource: LinkTo<any>;
405404
relation: string;
406405
name: string;
407406
public?: boolean;
408-
session: Session;
409407
}) {
410408
const initialProps = {
411409
name,

src/components/file/handlers/attach-project-root-directory.handler.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ export class AttachProjectRootDirectoryHandler
1515
resource: project,
1616
relation: 'rootDirectory',
1717
name: `${project.id} root directory`,
18-
session,
1918
});
2019

2120
event.project = {

test/utility/create-directory.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,29 @@
11
import { faker } from '@faker-js/faker';
22
import { startCase } from 'lodash';
33
import { type ID } from '~/common';
4-
import { loggedInSession } from '~/common/session';
5-
import { AuthenticationService } from '../../src/components/authentication';
4+
import {
5+
AuthenticationService,
6+
SessionHost,
7+
} from '../../src/components/authentication';
68
import { FileService } from '../../src/components/file';
79
import { type TestApp } from './create-app';
810
import { fileNode, type RawDirectory } from './fragments';
911
import { gql } from './gql-tag';
1012

1113
export async function createRootDirectory(app: TestApp, name?: string) {
1214
name = name ?? startCase(faker.lorem.words());
13-
const rawSession = await app
15+
const session = await app
1416
.get(AuthenticationService)
1517
.resumeSession(app.graphql.authToken);
16-
const session = loggedInSession(rawSession);
17-
const id = await app.get(FileService).createRootDirectory({
18-
// An attachment point is required, so just use the current user.
19-
resource: { __typename: 'User', id: session.userId },
20-
relation: 'dir',
21-
name,
22-
session,
18+
return await app.get(SessionHost).withSession(session, async () => {
19+
const id = await app.get(FileService).createRootDirectory({
20+
// An attachment point is required, so just use the current user.
21+
resource: { __typename: 'User', id: session.userId },
22+
relation: 'dir',
23+
name,
24+
});
25+
return await app.get(FileService).getDirectory(id, session);
2326
});
24-
return await app.get(FileService).getDirectory(id, session);
2527
}
2628

2729
export async function createDirectory(

0 commit comments

Comments
 (0)