You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Events.spec.ts 1.4KB

123456789101112131415161718192021222324252627282930313233343536
  1. import * as exported from "./Events";
  2. // this test is brittle on purpose because it's designed to ensure that the TypeScript conversion maintains backward compatibility
  3. describe( "/service/statistics/Events members", () => {
  4. const {
  5. AUDIO_LEVEL,
  6. BEFORE_DISPOSED,
  7. BYTE_SENT_STATS,
  8. CONNECTION_STATS,
  9. LONG_TASKS_STATS,
  10. Events,
  11. ...others
  12. } = exported as any; // TODO: remove cast after typescript conversion
  13. it( "known members", () => {
  14. expect( AUDIO_LEVEL ).toBe( 'statistics.audioLevel' );
  15. expect( BEFORE_DISPOSED ).toBe( 'statistics.before_disposed' );
  16. expect( BYTE_SENT_STATS ).toBe( 'statistics.byte_sent_stats' );
  17. expect( CONNECTION_STATS ).toBe( 'statistics.connectionstats' );
  18. expect( LONG_TASKS_STATS ).toBe( 'statistics.long_tasks_stats' );
  19. expect( Events ).toBeDefined();
  20. expect( Events.AUDIO_LEVEL ).toBe( 'statistics.audioLevel' );
  21. expect( Events.BEFORE_DISPOSED ).toBe( 'statistics.before_disposed' );
  22. expect( Events.BYTE_SENT_STATS ).toBe( 'statistics.byte_sent_stats' );
  23. expect( Events.CONNECTION_STATS ).toBe( 'statistics.connectionstats' );
  24. expect( Events.LONG_TASKS_STATS ).toBe( 'statistics.long_tasks_stats' );
  25. } );
  26. it( "unknown members", () => {
  27. const keys = Object.keys( others );
  28. expect( keys ).withContext( `Extra members: ${ keys.join( ", " ) }` ).toEqual( [] );
  29. } );
  30. } );