Skip to content

Commit 711017b

Browse files
lmiller1990AtofStryker
authored andcommitted
test: placeholder to prevent false failure
1 parent a268053 commit 711017b

File tree

2 files changed

+81
-75
lines changed

2 files changed

+81
-75
lines changed

test/specs/render.spec.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,17 @@ import { render } from '@vue/server-test-utils'
22
import Cheerio from 'cheerio'
33
import { describeDoNotRunIf } from 'conditional-specs'
44

5-
describeDoNotRunIf(process.env.TEST_ENV !== 'node', 'render', () => {
6-
it('returns a cheerio wrapper of the rendered component', async () => {
7-
const TestComponent = {
8-
template: '<div><h2>Test</h2><p></p><p></p></div>'
9-
}
10-
const wrapper = await render(TestComponent)
11-
expect(wrapper).toBeAnInstanceof(Cheerio)
12-
expect(wrapper.find('h2').text()).toEqual('Test')
13-
expect(wrapper.find('p').length).toEqual(2)
5+
describe('render', () => {
6+
it.todo('placeholder')
7+
describeDoNotRunIf(process.env.TEST_ENV !== 'node', 'render', () => {
8+
it('returns a cheerio wrapper of the rendered component', async () => {
9+
const TestComponent = {
10+
template: '<div><h2>Test</h2><p></p><p></p></div>'
11+
}
12+
const wrapper = await render(TestComponent)
13+
expect(wrapper).toBeAnInstanceof(Cheerio)
14+
expect(wrapper.find('h2').text()).toEqual('Test')
15+
expect(wrapper.find('p').length).toEqual(2)
16+
})
1417
})
1518
})

test/specs/renderToString.spec.js

Lines changed: 69 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -3,88 +3,91 @@ import { createLocalVue } from '@vue/test-utils'
33
import ComponentWithChild from '~resources/components/component-with-child.vue'
44
import { describeDoNotRunIf } from 'conditional-specs'
55

6-
describeDoNotRunIf(process.env.TEST_ENV !== 'node', 'renderToString', () => {
7-
it('returns a promise', async () => {
8-
const str = await renderToString({
9-
template: `<div>{{this.val}}</div>`,
10-
data() {
11-
return { val: '123' }
12-
}
6+
describe('renderToString', () => {
7+
it.todo('placeholder')
8+
describeDoNotRunIf(process.env.TEST_ENV !== 'node', 'renderToString', () => {
9+
it('returns a promise', async () => {
10+
const str = await renderToString({
11+
template: `<div>{{this.val}}</div>`,
12+
data() {
13+
return { val: '123' }
14+
}
15+
})
16+
expect(str).toContain('123')
1317
})
14-
expect(str).toContain('123')
15-
})
1618

17-
it('mounts functional component with a defined context when no context object passed in options', async () => {
18-
const defaultValue = '[vue-test-utils]: testProp default value'
19-
const Component = {
20-
functional: true,
21-
props: {
22-
testProp: {
23-
type: String,
24-
default: defaultValue
25-
}
26-
},
27-
render: (h, { props }) => h('div', props.testProp)
28-
}
29-
const str = await renderToString(Component)
30-
expect(str).toContain(defaultValue)
31-
})
19+
it('mounts functional component with a defined context when no context object passed in options', async () => {
20+
const defaultValue = '[vue-test-utils]: testProp default value'
21+
const Component = {
22+
functional: true,
23+
props: {
24+
testProp: {
25+
type: String,
26+
default: defaultValue
27+
}
28+
},
29+
render: (h, { props }) => h('div', props.testProp)
30+
}
31+
const str = await renderToString(Component)
32+
expect(str).toContain(defaultValue)
33+
})
3234

33-
it('mounts component using passed localVue as base Vue', async () => {
34-
const TestComponent = {
35-
template: `<div>{{test}}</div>`
36-
}
37-
const localVue = createLocalVue()
38-
localVue.prototype.test = 'some value'
39-
const str = await renderToString(TestComponent, {
40-
localVue: localVue
35+
it('mounts component using passed localVue as base Vue', async () => {
36+
const TestComponent = {
37+
template: `<div>{{test}}</div>`
38+
}
39+
const localVue = createLocalVue()
40+
localVue.prototype.test = 'some value'
41+
const str = await renderToString(TestComponent, {
42+
localVue: localVue
43+
})
44+
expect(str).toContain('some value')
4145
})
42-
expect(str).toContain('some value')
43-
})
4446

45-
it('adds variables to vm when passed', async () => {
46-
const TestComponent = {
47-
template: `
47+
it('adds variables to vm when passed', async () => {
48+
const TestComponent = {
49+
template: `
4850
<div>
4951
{{$store.store}}
5052
{{$route.path}}
5153
</div>
5254
`
53-
}
54-
const $store = { store: true }
55-
const $route = { path: 'http://test.com' }
56-
const str = await renderToString(TestComponent, {
57-
mocks: {
58-
$store,
59-
$route
6055
}
61-
})
62-
expect(str).toContain('true')
63-
expect(str).toContain('http://test.com')
64-
})
65-
66-
it('mounts component with $parent set to options.parentComponent', async () => {
67-
const Parent = {
68-
data: () => ({
69-
customName: 'Parent Name'
56+
const $store = { store: true }
57+
const $route = { path: 'http://test.com' }
58+
const str = await renderToString(TestComponent, {
59+
mocks: {
60+
$store,
61+
$route
62+
}
7063
})
71-
}
72-
const TestComponent = {
73-
template: '<div>{{$parent.customName}}</div>'
74-
}
75-
const str = await renderToString(TestComponent, {
76-
parentComponent: Parent
64+
expect(str).toContain('true')
65+
expect(str).toContain('http://test.com')
7766
})
78-
expect(str).toContain('Parent Name')
79-
})
8067

81-
it('replaces component with template string ', async () => {
82-
const str = await renderToString(ComponentWithChild, {
83-
stubs: {
84-
ChildComponent: '<div class="stub"></div>'
68+
it('mounts component with $parent set to options.parentComponent', async () => {
69+
const Parent = {
70+
data: () => ({
71+
customName: 'Parent Name'
72+
})
73+
}
74+
const TestComponent = {
75+
template: '<div>{{$parent.customName}}</div>'
8576
}
77+
const str = await renderToString(TestComponent, {
78+
parentComponent: Parent
79+
})
80+
expect(str).toContain('Parent Name')
8681
})
8782

88-
expect(str).toContain('"stub"')
83+
it('replaces component with template string ', async () => {
84+
const str = await renderToString(ComponentWithChild, {
85+
stubs: {
86+
ChildComponent: '<div class="stub"></div>'
87+
}
88+
})
89+
90+
expect(str).toContain('"stub"')
91+
})
8992
})
9093
})

0 commit comments

Comments
 (0)