]> git.ipfire.org Git - thirdparty/vuejs/router.git/commitdiff
test: add test for query
authorEduardo San Martin Morote <posva13@gmail.com>
Tue, 16 Apr 2019 16:35:49 +0000 (18:35 +0200)
committerEduardo San Martin Morote <posva13@gmail.com>
Tue, 16 Apr 2019 16:35:49 +0000 (18:35 +0200)
__tests__/query.spec.js [new file with mode: 0644]

diff --git a/__tests__/query.spec.js b/__tests__/query.spec.js
new file mode 100644 (file)
index 0000000..fe561db
--- /dev/null
@@ -0,0 +1,18 @@
+// @ts-check
+require('./helper')
+const expect = require('expect')
+const { parseQuery } = require('../src/history/utils')
+
+describe('parseQuery', () => {
+  it('works with leading ?', () => {
+    expect(parseQuery('?foo=a')).toEqual({
+      foo: 'a',
+    })
+  })
+
+  it('works without leading ?', () => {
+    expect(parseQuery('foo=a')).toEqual({
+      foo: 'a',
+    })
+  })
+})