summaryrefslogtreecommitdiff
path: root/spec/frontend/snippets
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2019-12-13 18:08:06 +0000
committerGitLab Bot <gitlab-bot@gitlab.com>2019-12-13 18:08:06 +0000
commit7cc6c10c68915f5019ab8c2029eeb462c8fed4ef (patch)
tree419e5fee5bb60e71bef076157627812d54e142bc /spec/frontend/snippets
parent630101f7f93847f39a4d2f87d92f514c973cdc1e (diff)
downloadgitlab-ce-7cc6c10c68915f5019ab8c2029eeb462c8fed4ef.tar.gz
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/frontend/snippets')
-rw-r--r--spec/frontend/snippets/components/app_spec.js41
1 files changed, 41 insertions, 0 deletions
diff --git a/spec/frontend/snippets/components/app_spec.js b/spec/frontend/snippets/components/app_spec.js
new file mode 100644
index 00000000000..535e71b6da7
--- /dev/null
+++ b/spec/frontend/snippets/components/app_spec.js
@@ -0,0 +1,41 @@
+import SnippetApp from '~/snippets/components/app.vue';
+import { createLocalVue, shallowMount } from '@vue/test-utils';
+
+describe('Snippet view app', () => {
+ let wrapper;
+ let snippetDataMock;
+ const localVue = createLocalVue();
+ const defaultProps = {
+ snippetGid: 'gid://gitlab/PersonalSnippet/35',
+ };
+
+ function createComponent({ props = defaultProps, snippetData = {} } = {}) {
+ snippetDataMock = jest.fn();
+ const $apollo = {
+ queries: {
+ snippetData: snippetDataMock,
+ },
+ };
+
+ wrapper = shallowMount(SnippetApp, {
+ sync: false,
+ mocks: { $apollo },
+ localVue,
+ propsData: {
+ ...props,
+ },
+ });
+
+ wrapper.setData({
+ snippetData,
+ });
+ }
+ afterEach(() => {
+ wrapper.destroy();
+ });
+
+ it('renders itself', () => {
+ createComponent();
+ expect(wrapper.find('.js-snippet-view').exists()).toBe(true);
+ });
+});