feat(opsserver,web): replace the Angular UI and REST management layer with a TypedRequest-based ops server and bundled web frontend
This commit is contained in:
@@ -3,8 +3,8 @@
|
||||
*/
|
||||
|
||||
import { assertEquals, assertExists } from 'jsr:@std/assert';
|
||||
import { describe, it, beforeAll, afterAll, beforeEach } from 'jsr:@std/testing/bdd';
|
||||
import { setupTestDb, teardownTestDb, cleanupTestDb, createTestUser } from '../../helpers/index.ts';
|
||||
import { afterAll, beforeAll, beforeEach, describe, it } from 'jsr:@std/testing/bdd';
|
||||
import { cleanupTestDb, createTestUser, setupTestDb, teardownTestDb } from '../../helpers/index.ts';
|
||||
import { Session } from '../../../ts/models/session.ts';
|
||||
|
||||
describe('Session Model', () => {
|
||||
@@ -70,9 +70,21 @@ describe('Session Model', () => {
|
||||
|
||||
describe('getUserSessions', () => {
|
||||
it('should return all valid sessions for user', async () => {
|
||||
await Session.createSession({ userId: testUserId, userAgent: 'Agent 1', ipAddress: '1.1.1.1' });
|
||||
await Session.createSession({ userId: testUserId, userAgent: 'Agent 2', ipAddress: '2.2.2.2' });
|
||||
await Session.createSession({ userId: testUserId, userAgent: 'Agent 3', ipAddress: '3.3.3.3' });
|
||||
await Session.createSession({
|
||||
userId: testUserId,
|
||||
userAgent: 'Agent 1',
|
||||
ipAddress: '1.1.1.1',
|
||||
});
|
||||
await Session.createSession({
|
||||
userId: testUserId,
|
||||
userAgent: 'Agent 2',
|
||||
ipAddress: '2.2.2.2',
|
||||
});
|
||||
await Session.createSession({
|
||||
userId: testUserId,
|
||||
userAgent: 'Agent 3',
|
||||
ipAddress: '3.3.3.3',
|
||||
});
|
||||
|
||||
const sessions = await Session.getUserSessions(testUserId);
|
||||
assertEquals(sessions.length, 3);
|
||||
@@ -110,9 +122,21 @@ describe('Session Model', () => {
|
||||
|
||||
describe('invalidateAllUserSessions', () => {
|
||||
it('should invalidate all user sessions', async () => {
|
||||
await Session.createSession({ userId: testUserId, userAgent: 'Agent 1', ipAddress: '1.1.1.1' });
|
||||
await Session.createSession({ userId: testUserId, userAgent: 'Agent 2', ipAddress: '2.2.2.2' });
|
||||
await Session.createSession({ userId: testUserId, userAgent: 'Agent 3', ipAddress: '3.3.3.3' });
|
||||
await Session.createSession({
|
||||
userId: testUserId,
|
||||
userAgent: 'Agent 1',
|
||||
ipAddress: '1.1.1.1',
|
||||
});
|
||||
await Session.createSession({
|
||||
userId: testUserId,
|
||||
userAgent: 'Agent 2',
|
||||
ipAddress: '2.2.2.2',
|
||||
});
|
||||
await Session.createSession({
|
||||
userId: testUserId,
|
||||
userAgent: 'Agent 3',
|
||||
ipAddress: '3.3.3.3',
|
||||
});
|
||||
|
||||
const count = await Session.invalidateAllUserSessions(testUserId, 'Security logout');
|
||||
assertEquals(count, 3);
|
||||
|
||||
Reference in New Issue
Block a user