Skip to content

Commit a918116

Browse files
code review
1 parent 766a812 commit a918116

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/server/src/AccountsServer.spec.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1429,6 +1429,7 @@ describe('Accounts', () => {
14291429

14301430
it('returns correct response if authorized', async () => {
14311431
const { accessToken } = Accounts.createTokens('555');
1432+
const createSession = jest.fn(() => Promise.resolve('001'));
14321433
Accounts.config(
14331434
{
14341435
//eslint-disable-next-line
@@ -1439,7 +1440,7 @@ describe('Accounts', () => {
14391440
{
14401441
findUserById: () => Promise.resolve(user),
14411442
findUserByUsername: () => Promise.resolve(impersonatedUser),
1442-
createSession: () => Promise.resolve('001'),
1443+
createSession,
14431444
},
14441445
);
14451446

@@ -1455,6 +1456,10 @@ describe('Accounts', () => {
14551456
tokens: { sessionId: '001', isImpersonated: true },
14561457
user: impersonatedUser,
14571458
});
1459+
expect(createSession).toHaveBeenCalledWith(impersonatedUser.id,
1460+
undefined,
1461+
undefined,
1462+
{ impersonatorUserId: user.id });
14581463
});
14591464
});
14601465

packages/server/src/DBInterface.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface DBInterface {
3333

3434
// Session related operations
3535
findSessionById(sessionId: string) : Promise<?SessionType>,
36-
createSession(userId: string, ip: ?string, userAgent: ?string, extraData: ?string) : Promise<string>,
36+
createSession(userId: string, ip: ?string, userAgent: ?string, extraData: ?Object) : Promise<string>,
3737
updateSession(sessionId: string, ip: string, userAgent: string) : Promise<void>,
3838
invalidateSession(sessionId: string): Promise<void>,
3939
invalidateAllSessions(userId: string): Promise<void>

0 commit comments

Comments
 (0)