Skip to content

Commit 248d596

Browse files
docs(website): typos and stuff
1 parent 77853b6 commit 248d596

File tree

8 files changed

+65
-25
lines changed

8 files changed

+65
-25
lines changed

packages/overmind-website/api/overmind.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,11 @@ By default, in **development**, Overmind will make sure that any usage of **cons
2929

3030
```marksy
3131
h(Example, { name: "api/app_options_logproxies" })
32+
```
33+
34+
## options.name
35+
If you have multiple instances of Overmind on the same page you can name your app to differentiate it in the devtools.
36+
37+
```marksy
38+
h(Example, { name: "api/app_options_name" })
3239
```
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
export default (ts) =>
2+
ts
3+
? [
4+
{
5+
fileName: 'overmind/index.ts',
6+
code: `
7+
...
8+
9+
export const overmindA = new Overmind(configA, {
10+
name: 'appA'
11+
})
12+
13+
export const overmindB = new Overmind(configB, {
14+
name: 'appB'
15+
})
16+
`,
17+
},
18+
]
19+
: [
20+
{
21+
fileName: 'overmind/index.js',
22+
code: `
23+
...
24+
25+
export const overmindA = new Overmind(configA, {
26+
name: 'appA'
27+
})
28+
29+
export const overmindB = new Overmind(configB, {
30+
name: 'appB'
31+
})
32+
`,
33+
},
34+
]

packages/overmind-website/examples/frontpage/actions.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ export default () => [
33
code: `
44
export const getItems = async ({ state, effects }) => {
55
state.isLoadingItems = true
6-
state.items = await effects.api.getItems()
6+
state.items = await effects.api.fetchItems()
77
state.isLoadingItems = false
88
}
99
`,

packages/overmind-website/examples/frontpage/effects.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
export default () => [
22
{
33
code: `
4-
import axios from 'axios'
5-
64
export const api = {
7-
getItems() {
8-
return axios.get('/api/items')
5+
fetchItems: async () => {
6+
const response = await fetch('/api/items')
7+
8+
return response.json()
99
}
1010
}
1111
`,

packages/overmind-website/examples/frontpage/test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
export default () => [
22
{
33
code: `
4-
import { createMock } from 'overmind'
4+
import { createOvermindMock } from 'overmind'
55
import { config } from './'
66
77
test('should get items', async () => {
8-
const mock = createMock(config, {
8+
const overmind = createOvermindMock(config, {
99
api: {
10-
getItems: () => Promise.resolve([{ id: 0, title: "foo" }])
10+
fetchItems: () => Promise.resolve([{ id: 0, title: "foo" }])
1111
}
1212
})
1313
14-
const mutations = await actions.getItems()
14+
const mutations = await overmind.actions.getItems()
1515
1616
expect(mutations).toMatchSnapshot()
1717
})

packages/overmind-website/examples/guide/writingtests/actionsnapshot.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ export default () => [
22
{
33
fileName: 'overmind/actions.test.ts',
44
code: `
5-
import { createMock } from 'overmind'
5+
import { createOvermindMock } from 'overmind'
66
import { config } from './'
77
88
describe('Actions', () => {
99
describe('getPost', () => {
1010
test('should get post with passed id', async () => {
11-
const mock = createMock(config, {
11+
const overmind = createOvermindMock(config, {
1212
api: {
1313
getPost(id) {
1414
return Promise.resolve({
@@ -18,20 +18,20 @@ describe('Actions', () => {
1818
}
1919
})
2020
21-
const mutations = await actions.getPost('1')
21+
const mutations = await overmind.actions.getPost('1')
2222
2323
expect(mutations).toMatchSnapshot()
2424
})
2525
test('should handle errors', async () => {
26-
const mock = createMock(config, {
26+
const overmind = createOvermindMock(config, {
2727
api = {
2828
getPost() {
2929
throw new Error('test')
3030
}
3131
}
3232
})
3333
34-
const mutations = await actions.getPost('1')
34+
const mutations = await overmind.actions.getPost('1')
3535
3636
expect(mutations).toMatchSnapshot()
3737
})

packages/overmind-website/examples/guide/writingtests/actiontest.ts

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@ export default () => [
22
{
33
fileName: 'overmind/actions.test.ts',
44
code: `
5-
import { createMock } from 'overmind'
5+
import { createOvermindMock } from 'overmind'
66
import { config } from './'
77
88
describe('Actions', () => {
99
describe('getPost', () => {
1010
test('should get post with passed id', async () => {
11-
const mock = createMock(config, {
11+
const overmind = createOvermindMock(config, {
1212
api: {
1313
getPost(id) {
1414
return Promise.resolve({
@@ -18,27 +18,27 @@ describe('Actions', () => {
1818
}
1919
})
2020
21-
await actions.getPost('1')
21+
await overmind.actions.getPost('1')
2222
23-
expect(mock.state).toEqual({
23+
expect(overmind.state).toEqual({
2424
isLoadingPost: false,
2525
currentPost: { id: '1' },
2626
error: null
2727
})
2828
})
2929
test('should handle errors', async () => {
30-
const mock = createMock(config, {
30+
const overmind = createOvermindMock(config, {
3131
api = {
3232
getPost() {
3333
throw new Error('test')
3434
}
3535
}
3636
})
3737
38-
await actions.getPost('1')
38+
await overmind.actions.getPost('1')
3939
40-
expect(mock.state.isLoadingPost).toBe(false)
41-
expect(mock.state.error.message).toBe('test')
40+
expect(overmind.state.isLoadingPost).toBe(false)
41+
expect(overmind.state.error.message).toBe('test')
4242
})
4343
})
4444
})

packages/overmind-website/src/components/FrontPage/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ h(Example, { name: "frontpage/effects" })
9696
<div key="1">
9797
<h2>SEPARATION OF LOGIC</h2>
9898
<p>
99-
Separate 3rd party apis and logic not specific to your
99+
Separate 3rd party APIs and logic not specific to your
100100
application by using <strong>effects</strong>. This will keep
101101
your application logic pure and without low level APIs
102102
cluttering your code
@@ -149,13 +149,12 @@ h(Example, { name: "frontpage/operators" })
149149
<h2>FUNCTIONAL ACTIONS</h2>
150150
<p>
151151
When pieces of logic becomes complex it is beneficial to write
152-
functional code. Overmind provides and API named{' '}
152+
functional code. Overmind provides an API named{' '}
153153
<strong>operators</strong> which gives you functional power as
154154
simple actions
155155
</p>
156156
</div>,
157157
][viewport.isMobile ? 'reverse' : 'slice']()}
158-
}
159158
</div>
160159
<div
161160
className={css(

0 commit comments

Comments
 (0)