easypiechart.chart.spec.js 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. "use strict";
  2. // with xdescribe, this is skipped.
  3. describe("creation of easy pie charts", function () {
  4. beforeAll(function () {
  5. // karma stores the loaded files relative to "base/".
  6. // This command is needed to load HTML fixtures
  7. jasmine.getFixtures().fixturesPath = "base/tests/web/fixtures";
  8. });
  9. it("should create new chart, but it's failure is expected for demonstration purpose", function () {
  10. // arrange
  11. // Theoretically we can load some html. What about jquery? could this work?
  12. // https://stackoverflow.com/questions/5337481/spying-on-jquery-selectors-in-jasmine
  13. loadFixtures("easypiechart.chart.fixture1.html");
  14. // for easy pie chart, we can fake the data result:
  15. var data = {
  16. result: [5]
  17. };
  18. // act
  19. var result = NETDATA.easypiechartChartCreate(createState(), data);
  20. // assert
  21. expect(result).toBe(true);
  22. });
  23. function createState(min, max) {
  24. // create a fake state with only needed properties.
  25. return {
  26. tmp: {
  27. easyPieChartMin: min,
  28. easyPieChartMax: max
  29. }
  30. };
  31. }
  32. });