Skip to content

Commit

Permalink
test: change tests
Browse files Browse the repository at this point in the history
  • Loading branch information
athif23 committed Jun 4, 2020
1 parent e8310c7 commit b91c8e7
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 28 deletions.
12 changes: 6 additions & 6 deletions test/fixtures/App.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<template>
<div>
<Header :name="name" />
<div class="flex blue">
<Header class="flex rounded-sm" :name="name" />
Hello {{ name }}
</div>
</template>
Expand All @@ -17,7 +17,7 @@ export default {
</script>

<style scoped>
div {
color: red;
}
</style>
.blue {
@apply bg-blue-500;
}
</style>
10 changes: 8 additions & 2 deletions test/fixtures/Header.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<header>
<header class="test">
This is header, {{ name }}
</header>
</template>
Expand All @@ -10,4 +10,10 @@ export default {
name: String
}
}
</script>
</script>

<style scoped>
.test {
color: red;
}
</style>
21 changes: 1 addition & 20 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ test.afterEach(async _ => {
});

test('can render html', async t => {
const { App } = await compileToHTML('./test/fixtures/App.vue', {
const { App } = await compileToHTML('./fixtures/App.vue', {
props: { name: t.context.props }
});
const result =
Expand All @@ -26,22 +26,3 @@ test('can render html', async t => {

t.true(App.includes(result));
});

test('can render mutiple files', async t => {
const { App, Header } = await compileToHTML(
['./test/fixtures/App.vue', './test/fixtures/Header.vue'],
{
props: [{ name: t.context.props }, { name: 'Header Props' }]
}
);
const appResult =
'<div data-server-rendered="true" data-v-d4599232><header data-v-d4599232>\n' +
' This is header, Athif Humam\n';

const headerResult =
'<header data-server-rendered="true">\n' +
' This is header, Header Props\n';

t.true(App.includes(appResult));
t.true(Header.includes(headerResult));
});

0 comments on commit b91c8e7

Please sign in to comment.