index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. const test = require('ava');
  2. const hydrawise = require('../index');
  3. const h = hydrawise('53DC-7E24-07E8-CD7D');
  4. test('Customer Details', t => {
  5. return h.customerdetails().then(data => {
  6. if (data.error_msg) {
  7. t.fail(`Error: ${data.error_msg}`);
  8. }
  9. t.pass();
  10. });
  11. });
  12. test('Status Schedule', t => {
  13. return h.statusschedule().then(data => {
  14. if (data.error_msg) {
  15. t.fail(`Error: ${data.error_msg}`);
  16. }
  17. t.pass();
  18. });
  19. });
  20. test('Status Schedule All', t => {
  21. return h.statusschedule('hydrawise_all').then(data => {
  22. if (data.error_msg) {
  23. t.fail(`Error: ${data.error_msg}`);
  24. }
  25. t.pass();
  26. });
  27. });
  28. test('Set Controller', t => {
  29. return h.setcontroller('11774').then(() => {
  30. t.pass();
  31. });
  32. });
  33. test('Stop Zones', t => {
  34. return h.setzone('stopall').then(data => {
  35. if (data.message_type === 'error') {
  36. t.fail(`Error: ${data.message}`);
  37. }
  38. t.pass();
  39. });
  40. });
  41. test('Run All Zones', t => {
  42. return h.setzone('runall', {period_id: '999', custom: '60'}).then(data => {
  43. if (data.message_type === 'error') {
  44. t.fail(`Error: ${data.message}`);
  45. }
  46. t.pass();
  47. });
  48. });