im.client.Test.js 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /**
  2. * IM客户端单元测试。单元测试编写规则:至少对对每个接口执行正反例测试,若有条件可以增加接口的性能测试。
  3. *
  4. * @author sand
  5. * @since 2016/12/24
  6. */
  7. let assert = require('assert');
  8. // 测试会话用的数据
  9. let Sessions = {
  10. MUC: {
  11. SessionId: "",
  12. Topics: [],
  13. DoctorA: "",
  14. DoctorB: "",
  15. Patient: ""
  16. },
  17. P2P: {
  18. SessionId: "",
  19. DoctorA: "",
  20. DoctorB: ""
  21. },
  22. Group: {
  23. SessionId: "",
  24. DoctorA: "",
  25. DoctorB: "",
  26. DoctorC: "",
  27. DoctorD: ""
  28. }
  29. };
  30. describe("IM SDK Unit Test", function () {
  31. /**
  32. * 用户API。测试范围:
  33. * 1 有效/无效用户ID登录/状态更新/退出
  34. */
  35. describe("User API", function () {
  36. describe("login", function () {
  37. it("should be 200 with valid user", function (done) {
  38. done();
  39. });
  40. it("should be 404 with invalid user", function (done) {
  41. done();
  42. });
  43. });
  44. describe("user status", function () {
  45. it("should be 200 with valid user", function (done) {
  46. done();
  47. });
  48. it("should be 404 with invalid user", function (done) {
  49. done();
  50. });
  51. });
  52. describe("logout", function () {
  53. it("should be 200 with valid user", function (done) {
  54. done();
  55. });
  56. it("should be 404 with invalid user", function (done) {
  57. done();
  58. });
  59. });
  60. });
  61. // Application API
  62. describe("Application API", function () {
  63. describe("get badge no", function () {
  64. it("should be 200 when with valid user", function (done) {
  65. done();
  66. });
  67. });
  68. });
  69. // 会话API
  70. describe("Session API", function () {
  71. describe("get sessions", function () {
  72. it("should be 200 when user login yet.", function (done) {
  73. done();
  74. });
  75. });
  76. });
  77. // 健康API
  78. describe("Health API", function () {
  79. describe("health", function () {
  80. it("should be 200 when system is allright", function (done) {
  81. done();
  82. });
  83. });
  84. });
  85. // 管理API
  86. describe("Management API", function () {
  87. describe("db_status", function () {
  88. it("should be 200 while database is ok", function (done) {
  89. done();
  90. });
  91. });
  92. });
  93. });