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.

VideoSIPGWConstants.spec.ts 2.3KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. import * as exported from "./VideoSIPGWConstants";
  2. // this test is brittle on purpose because it's designed to ensure that the TypeScript conversion maintains backward compatibility
  3. describe( "/modules/videosipgw/VideoSIPGWConstants members", () => {
  4. const {
  5. STATUS_AVAILABLE,
  6. STATUS_UNDEFINED,
  7. STATUS_BUSY,
  8. STATE_ON,
  9. STATE_OFF,
  10. STATE_PENDING,
  11. STATE_RETRYING,
  12. STATE_FAILED,
  13. ERROR_NO_CONNECTION,
  14. ERROR_SESSION_EXISTS,
  15. VideoSIPGWStatusConstants,
  16. VideoSIPGWStateConstants,
  17. VideoSIPGWErrorConstants,
  18. ...others
  19. } = exported;
  20. it( "known members", () => {
  21. expect( STATUS_AVAILABLE ).toBe( 'available' );
  22. expect( STATUS_UNDEFINED ).toBe( 'undefined' );
  23. expect( STATUS_BUSY ).toBe( 'busy' );
  24. expect( STATE_ON ).toBe( 'on' );
  25. expect( STATE_OFF ).toBe( 'off' );
  26. expect( STATE_PENDING ).toBe( 'pending' );
  27. expect( STATE_RETRYING ).toBe( 'retrying' );
  28. expect( STATE_FAILED ).toBe( 'failed' );
  29. expect( ERROR_NO_CONNECTION ).toBe( 'error_no_connection' );
  30. expect( ERROR_SESSION_EXISTS ).toBe( 'error_session_already_exists' );
  31. expect( VideoSIPGWStatusConstants ).toBeDefined();
  32. expect( VideoSIPGWStateConstants ).toBeDefined();
  33. expect( VideoSIPGWErrorConstants ).toBeDefined();
  34. expect( VideoSIPGWStatusConstants.STATUS_AVAILABLE ).toBe( 'available' );
  35. expect( VideoSIPGWStatusConstants.STATUS_UNDEFINED ).toBe( 'undefined' );
  36. expect( VideoSIPGWStatusConstants.STATUS_BUSY ).toBe( 'busy' );
  37. expect( VideoSIPGWStateConstants.STATE_ON ).toBe( 'on' );
  38. expect( VideoSIPGWStateConstants.STATE_OFF ).toBe( 'off' );
  39. expect( VideoSIPGWStateConstants.STATE_PENDING ).toBe( 'pending' );
  40. expect( VideoSIPGWStateConstants.STATE_RETRYING ).toBe( 'retrying' );
  41. expect( VideoSIPGWStateConstants.STATE_FAILED ).toBe( 'failed' );
  42. expect( VideoSIPGWErrorConstants.ERROR_NO_CONNECTION ).toBe( 'error_no_connection' );
  43. expect( VideoSIPGWErrorConstants.ERROR_SESSION_EXISTS ).toBe( 'error_session_already_exists' );
  44. } );
  45. it( "unknown members", () => {
  46. const keys = Object.keys( others );
  47. expect( keys ).withContext( `Extra members: ${ keys.join( ", " ) }` ).toEqual( [] );
  48. } );
  49. } );