uri.js 714 B

1234567891011121314151617181920212223242526272829303132
  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. });