uri.js 712 B

123456789101112131415161718192021222324252627282930
  1. describe('UriService', function() {
  2. let $service;
  3. // Ignoring page reload request
  4. beforeAll(() => window.onbeforeunload = () => null);
  5. beforeEach(function() {
  6. module('3ema.services');
  7. // Inject the service
  8. inject(function(UriService) {
  9. $service = UriService;
  10. });
  11. });
  12. it('parses query parameters', () => {
  13. const parsed = $service.parseQueryParams('foo=bar&baz=a%20b%20c');
  14. expect(parsed).toEqual({
  15. 'foo': 'bar',
  16. 'baz': 'a b c',
  17. });
  18. });
  19. it('parses empty query parameters', () => {
  20. const parsed = $service.parseQueryParams('');
  21. expect(parsed).toEqual({});
  22. });
  23. });