From 385aced972b96c5f4d4fd7debe134526cf0d50bc Mon Sep 17 00:00:00 2001 From: Meghea Iulian Date: Mon, 28 Feb 2022 20:12:42 +0200 Subject: [PATCH] chore: cleanup --- test/location.test.js | 100 ------------------------------------------ 1 file changed, 100 deletions(-) delete mode 100644 test/location.test.js diff --git a/test/location.test.js b/test/location.test.js deleted file mode 100644 index 094f883..0000000 --- a/test/location.test.js +++ /dev/null @@ -1,100 +0,0 @@ -import { - assert, html, fixture -} from '@open-wc/testing'; - -import { microTask } from '@polymer/polymer/lib/utils/async'; -import '../cosmoz-page-location'; - -/* eslint-disable max-lines-per-function */ -suite('cosmoz-page-location', () => { - let location; - const tests = { - 'path/to/route': { - hashBang: false, - path: 'path/to/route', - hash: {}, - query: {} - }, - 'path/to/route#hashKey=hashValue': { - hashBang: false, - path: 'path/to/route', - hash: { - hashKey: 'hashValue' - }, - query: {} - }, - 'path/to/route?queryKey=queryValue': { - hashBang: false, - path: 'path/to/route', - hash: {}, - query: { - queryKey: 'queryValue' - } - }, - 'path/to/route?queryKey=queryValue#hashKey=hashValue': { - hashBang: false, - path: 'path/to/route', - hash: { - hashKey: 'hashValue' - }, - query: { - queryKey: 'queryValue' - } - }, - '!path/to/route': { - hashBang: false, - path: '!path/to/route', - hash: {}, - query: {} - }, - '!/path/to/route': { - hashBang: true, - path: '/path/to/route', - hash: {}, - query: {} - } - }; - - setup(async () => { - location = await fixture(html``); - await new Promise(resolve => microTask.run(resolve)); - - }); - - Object.keys(tests).forEach((key, index) => { - test('parses location #' + index, () => { - assert.deepEqual(location._parse(key), tests[key]); - }); - }); - - Object.keys(tests).forEach((key, index) => { - const value = tests[key]; - test('encodes location #' + index, () => { - assert.equal(location._encode(value), key); - }); - }); - - test('getRouteUrl returns route url', () => { - assert.equal(location.getRouteUrl(), '#'); - assert.equal(location.getRouteUrl({ - hashBang: false, - path: 'path/to/route', - hash: { - hashKey: 'hashValue' - }, - query: {} - }), '#path/to/route#hashKey=hashValue'); - }); - - test('getAppUrl returns app url with query', () => { - const parts = location.getAppUrl({ queryKey: 'queryValue' }).split('?'); - assert.include(parts[parts.length - 1], 'queryKey=queryValue'); - }); - - test('_routeChanged updates _appHashString', () => { - location.routeQuery = { - queryKey: 'queryValue' - }; - assert.equal(location._appHashString, '?queryKey=queryValue'); - }); -});