import { StreamAuthenticationModel, StreamAuthenticationSchema, } from './stream-authentication.model'; describe('StreamAuthenticationModel', () => { describe('constructor', () => { it('should create and initialize empty model', () => { const model = new StreamAuthenticationModel(); expect(model.streamPassword).toBe(null); }); it('should intialize model from schema', () => { const schema: StreamAuthenticationSchema = { stream_password: 'test-pass', }; const model = new StreamAuthenticationModel(schema); expect(model.streamPassword).toBe(schema.stream_password); }); }); describe('#fromSchema', () => { it('should initialize from a schema input', () => { const model = new StreamAuthenticationModel(); expect(model.streamPassword).toBe(null); const schema: StreamAuthenticationSchema = { stream_password: 'test-pass', }; model.fromSchema(schema); expect(model.streamPassword).toBe(schema.stream_password); }); }); describe('#toSchema', () => { it('should build a schema object from the model', () => { const model = new StreamAuthenticationModel(); const schema: StreamAuthenticationSchema = { stream_password: 'test-pass', }; model.fromSchema(schema); const newSchema = model.toSchema(); expect(newSchema).toStrictEqual(schema); }); }); });