Skip to content

Commit 73329d7

Browse files
committed
update all tests to use compacted format
1 parent 926d995 commit 73329d7

File tree

4 files changed

+100
-212
lines changed

4 files changed

+100
-212
lines changed

src/components/Kanban.stories.js

Lines changed: 30 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,37 @@
1-
import { storiesOf, specs, describe, it } from '!/facade'
2-
import { render, cleanup } from '@testing-library/svelte'
3-
import expect from 'expect'
1+
import { componentStories, it, render, expect } from '!/testing-framework'
42

53
import Kanban from './Kanban.svelte'
64
import markdownNotes from './Kanban.stories.md'
75

8-
storiesOf('Kanban|Whole board', module)
6+
componentStories('Kanban|Whole board', Kanban, module, markdownNotes)
97

10-
.add('empty state',
11-
() => {
12-
specs(() => describe('empty state', () => {
13-
it('should render', async () => {
14-
expect(render(Kanban)).toBeTruthy()
15-
cleanup()
16-
})
17-
}))
8+
.add('empty state', {}, (props) => {
9+
it('should render', async () => {
10+
expect(render(Kanban, { props })).toBeTruthy()
11+
})
12+
})
1813

19-
return {
20-
Component: Kanban,
21-
props: {
14+
.add('with tasks', {
15+
bins: [{
16+
title: 'first batch of tasks',
17+
note: 'doing stuff',
18+
due: new Date(),
19+
cards: [{
20+
note: 'a task that needs doing',
21+
due: new Date(),
22+
members: [
23+
{ image: 'https://randomuser.me/api/portraits/women/28.jpg' },
24+
{ image: 'https://randomuser.me/api/portraits/women/23.jpg' },
25+
],
26+
}],
27+
outputs: [{
28+
resourceClassifiedAs: {
29+
name: 'an output resource',
2230
},
23-
}
24-
},
25-
{ notes: { markdown: markdownNotes } },
26-
)
27-
28-
.add(
29-
'with tasks',
30-
() => {
31-
const props = {
32-
bins: [{
33-
title: 'first batch of tasks',
34-
note: 'doing stuff',
35-
due: new Date(),
36-
cards: [{
37-
note: 'a task that needs doing',
38-
due: new Date(),
39-
members: [
40-
{ image: 'https://randomuser.me/api/portraits/women/28.jpg' },
41-
{ image: 'https://randomuser.me/api/portraits/women/23.jpg' },
42-
],
43-
}],
44-
outputs: [{
45-
resourceClassifiedAs: {
46-
name: 'an output resource',
47-
},
48-
}],
49-
}],
50-
}
51-
52-
specs(() => describe('with tasks', () => {
53-
it('should render', async () => {
54-
expect(render(Kanban, { props })).toBeTruthy()
55-
cleanup()
56-
})
57-
}))
58-
59-
return {
60-
Component: Kanban,
61-
props,
62-
}
63-
},
64-
{ notes: { markdown: markdownNotes } },
65-
)
31+
}],
32+
}],
33+
}, (props) => {
34+
it('should render', async () => {
35+
expect(render(Kanban, { props })).toBeTruthy()
36+
})
37+
})
Lines changed: 26 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -1,60 +1,30 @@
1-
import { storiesOf, specs, describe, it } from '!/facade'
2-
import { render, cleanup } from '@testing-library/svelte'
3-
import expect from 'expect'
1+
import { componentStories, it, render, expect } from '!/testing-framework'
42

53
import Bin from './Bin.svelte'
64
import markdownNotes from './Bin.stories.md'
75

8-
storiesOf('Kanban|Task batch', module)
9-
10-
.add(
11-
'empty state',
12-
() => {
13-
const props = {
14-
title: 'an empty task bin',
15-
}
16-
17-
specs(() => describe('empty state', () => {
18-
it('should render', async () => {
19-
expect(render(Bin, { props })).toBeTruthy()
20-
cleanup()
21-
})
22-
}))
23-
24-
return {
25-
Component: Bin,
26-
props,
27-
}
28-
},
29-
{ notes: { markdown: markdownNotes } },
30-
)
31-
32-
.add(
33-
'with cards',
34-
() => {
35-
const props = {
36-
title: 'bin with cards',
37-
cards: [
38-
{
39-
members: [{ image: 'https://randomuser.me/api/portraits/women/28.jpg' }],
40-
due: new Date(),
41-
note: 'need to do a thing',
42-
title: 'first task',
43-
},
44-
],
45-
}
46-
47-
specs(() => describe('with cards', () => {
48-
it('should render', async () => {
49-
expect(render(Bin, { props })).toBeTruthy()
50-
cleanup()
51-
})
52-
}))
53-
54-
return {
55-
Component: Bin,
56-
props,
57-
}
58-
},
59-
{ notes: { markdown: markdownNotes } },
60-
)
6+
componentStories('Kanban|Task batch', Bin, module, markdownNotes)
7+
8+
.add('empty state', {
9+
title: 'an empty task bin',
10+
}, (props) => {
11+
it('should render', async () => {
12+
expect(render(Bin, { props })).toBeTruthy()
13+
})
14+
})
15+
16+
.add('with cards', {
17+
title: 'bin with cards',
18+
cards: [
19+
{
20+
members: [{ image: 'https://randomuser.me/api/portraits/women/28.jpg' }],
21+
due: new Date(),
22+
note: 'need to do a thing',
23+
title: 'first task',
24+
},
25+
],
26+
}, (props) => {
27+
it('should render', async () => {
28+
expect(render(Bin, { props })).toBeTruthy()
29+
})
30+
})
Lines changed: 19 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,25 @@
1-
import { storiesOf, specs, describe, it } from '!/facade'
2-
import { render, cleanup } from '@testing-library/svelte'
3-
import expect from 'expect'
1+
import { componentStories, it, render, expect } from '!/testing-framework'
42

53
import Card from './Card.svelte'
64
import markdownNotes from './Card.stories.md'
75

8-
storiesOf('Kanban|Task card', module)
6+
componentStories('Kanban|Task card', Card, module, markdownNotes)
97

10-
.add(
11-
'empty state',
12-
() => {
13-
specs(() => describe('empty state', () => {
14-
it('should render', async () => {
15-
expect(render(Card)).toBeTruthy()
16-
cleanup()
17-
})
18-
}))
8+
.add('empty state', {}, (props) => {
9+
it('should render', async () => {
10+
expect(render(Card, { props })).toBeTruthy()
11+
})
12+
})
1913

20-
return {
21-
Component: Card,
22-
}
23-
},
24-
{ notes: { markdown: markdownNotes } },
25-
)
26-
27-
.add(
28-
'with linked task',
29-
() => {
30-
const props = {
31-
note: 'a task that needs doing',
32-
due: new Date(),
33-
members: [
34-
{ image: 'https://randomuser.me/api/portraits/women/28.jpg' },
35-
{ image: 'https://randomuser.me/api/portraits/women/23.jpg' },
36-
],
37-
}
38-
39-
specs(() => describe('with linked task', () => {
40-
it('should render', async () => {
41-
expect(render(Card, { props })).toBeTruthy()
42-
cleanup()
43-
})
44-
}))
45-
46-
return {
47-
Component: Card,
48-
props,
49-
}
50-
},
51-
{ notes: { markdown: markdownNotes } },
52-
)
14+
.add('with linked task', {
15+
note: 'a task that needs doing',
16+
due: new Date(),
17+
members: [
18+
{ image: 'https://randomuser.me/api/portraits/women/28.jpg' },
19+
{ image: 'https://randomuser.me/api/portraits/women/23.jpg' },
20+
],
21+
}, (props) => {
22+
it('should render', async () => {
23+
expect(render(Card, { props })).toBeTruthy()
24+
})
25+
})
Lines changed: 25 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,58 +1,31 @@
1-
import { storiesOf, specs, describe, it } from '!/facade'
2-
import { render, cleanup } from '@testing-library/svelte'
3-
import expect from 'expect'
1+
import { componentStories, it, render, expect } from '!/testing-framework'
42

53
import Output from './Output.svelte'
64
import markdownNotes from './Output.stories.md'
75

8-
storiesOf('Kanban|Batch output', module)
6+
componentStories('Kanban|Batch output', Output, module, markdownNotes)
97

10-
.add(
11-
'empty state',
12-
() => {
13-
specs(() => describe('empty state', () => {
14-
it('should render', async () => {
15-
expect(render(Output)).toBeTruthy()
16-
cleanup()
17-
})
18-
}))
8+
.add('empty state', {}, (props) => {
9+
it('should render', async () => {
10+
expect(render(Output, { props })).toBeTruthy()
11+
})
12+
})
1913

20-
return {
21-
Component: Output,
22-
}
23-
},
24-
{ notes: { markdown: markdownNotes } },
25-
)
26-
27-
.add(
28-
'with output resources',
29-
() => {
30-
const props = {
31-
outputs: [
32-
{
33-
resourceClassifiedAs: {
34-
name: 'an output resource',
35-
},
36-
},
37-
{
38-
resourceClassifiedAs: {
39-
name: 'another output resource',
40-
},
41-
},
42-
],
43-
}
44-
45-
specs(() => describe('with output resources', () => {
46-
it('should render', async () => {
47-
expect(render(Output, { props })).toBeTruthy()
48-
cleanup()
49-
})
50-
}))
51-
52-
return {
53-
Component: Output,
54-
props,
55-
}
56-
},
57-
{ notes: { markdown: markdownNotes } },
58-
)
14+
.add('with output resources', {
15+
outputs: [
16+
{
17+
resourceClassifiedAs: {
18+
name: 'an output resource',
19+
},
20+
},
21+
{
22+
resourceClassifiedAs: {
23+
name: 'another output resource',
24+
},
25+
},
26+
],
27+
}, (props) => {
28+
it('should render', async () => {
29+
expect(render(Output, { props })).toBeTruthy()
30+
})
31+
})

0 commit comments

Comments
 (0)