global-integration-with-new-context.js 1016 B

1234567891011121314151617181920212223242526272829
  1. /* global MyCustomLogger, log */
  2. "use strict";
  3. describe("loglevel from a global <script> tag with a custom context", function () {
  4. it("is available globally", function () {
  5. expect(MyCustomLogger).not.toBeUndefined();
  6. });
  7. it("doesn't have log defined globally", function () {
  8. expect(window.log).not.toBeDefined();
  9. });
  10. it("allows setting the logging level", function () {
  11. MyCustomLogger.setLevel(MyCustomLogger.levels.TRACE);
  12. MyCustomLogger.setLevel(MyCustomLogger.levels.DEBUG);
  13. MyCustomLogger.setLevel(MyCustomLogger.levels.INFO);
  14. MyCustomLogger.setLevel(MyCustomLogger.levels.WARN);
  15. MyCustomLogger.setLevel(MyCustomLogger.levels.ERROR);
  16. });
  17. it("successfully logs", function () {
  18. window.console = { "log": jasmine.createSpy("log") };
  19. MyCustomLogger.setLevel(MyCustomLogger.levels.INFO);
  20. MyCustomLogger.info("test message");
  21. expect(console.log).toHaveBeenCalledWith("test message");
  22. });
  23. });