diff options
author | Phil Hughes <me@iamphill.com> | 2019-05-20 11:41:28 +0300 |
---|---|---|
committer | Filipa Lacerda <filipa@gitlab.com> | 2019-05-20 11:41:28 +0300 |
commit | 404314c6193d94f106e687db9fc5bd71bab63835 (patch) | |
tree | d8dc52e9678d2d22ec3c737f420adec782d2116b /spec/frontend | |
parent | 2f613f28ba286be648d4a9616404aa2a3a6b2a03 (diff) |
Setup Vue app for repository file listing
Part of https://gitlab.com/gitlab-org/gitlab-ce/issues/61578
Diffstat (limited to 'spec/frontend')
-rw-r--r-- | spec/frontend/repository/router_spec.js | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/frontend/repository/router_spec.js b/spec/frontend/repository/router_spec.js new file mode 100644 index 00000000000..f61a0ccd1e6 --- /dev/null +++ b/spec/frontend/repository/router_spec.js @@ -0,0 +1,23 @@ +import IndexPage from '~/repository/pages/index.vue'; +import TreePage from '~/repository/pages/tree.vue'; +import createRouter from '~/repository/router'; + +describe('Repository router spec', () => { + it.each` + path | component | componentName + ${'/'} | ${IndexPage} | ${'IndexPage'} + ${'/tree/master'} | ${TreePage} | ${'TreePage'} + ${'/tree/master/app/assets'} | ${TreePage} | ${'TreePage'} + ${'/tree/123/app/assets'} | ${null} | ${'null'} + `('sets component as $componentName for path "$path"', ({ path, component }) => { + const router = createRouter('', 'master'); + + const componentsForRoute = router.getMatchedComponents(path); + + expect(componentsForRoute.length).toBe(component ? 1 : 0); + + if (component) { + expect(componentsForRoute).toContain(component); + } + }); +}); |