Resolve RecordName, EMailAddress & RealName via dscl at startup and use that account for all requests without interactive login. Co-authored-by: Cursor <cursoragent@cursor.com>
22 lines
772 B
TypeScript
22 lines
772 B
TypeScript
import { describe, expect, test } from 'bun:test';
|
|
|
|
import {
|
|
readOsIdentity,
|
|
userFromOsIdentity,
|
|
} from '../src/os-user.ts';
|
|
|
|
describe('os-user (dscl)', () => {
|
|
test('reads RecordName and EMailAddress from dscl', async () => {
|
|
const identity = await readOsIdentity();
|
|
expect(identity.recordName.length).toBeGreaterThan(0);
|
|
expect(identity.email).toContain('@');
|
|
expect(identity.displayName.length).toBeGreaterThan(0);
|
|
|
|
const user = await userFromOsIdentity(identity);
|
|
expect(user.uid).toMatch(
|
|
/^[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/,
|
|
);
|
|
expect(user.email).toBe(identity.email);
|
|
expect(user.displayName).toBe(identity.displayName);
|
|
});
|
|
});
|