Skip to content

Commit 67df049

Browse files
martinjlowmuittorio
authored andcommitted
chore(docs): Apply minor corrections to create-mock.mdx
1 parent 42a81bb commit 67df049

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

ui/src/views/create-mock.mdx

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,29 +17,33 @@ interface Person {
1717
const mock = createMock<Person>();
1818
mock.id // ""
1919
mock.getName() // ""
20-
mock.details // "{phone: 0} "
20+
mock.details // { phone: 0 }
2121
```
2222

23-
## Default values
23+
## Property overrides
24+
25+
If you desire, you may override the otherwise mocked properties of an interface.
26+
27+
You don't have to provide the entire interface, just a partial object of the one you are mocking.
2428

25-
You can also define default values to overrides specific fields
26-
You dont have to provide the entire interface, just a partial of the one to mock
2729
```ts
2830
import { createMock } from 'ts-auto-mock';
2931

3032
interface Person {
3133
id: string;
3234
getName(): string;
3335
details: {
34-
phone: number
36+
phone: number
3537
}
3638
}
39+
3740
const mock = createMock<Person>({
3841
details: {
39-
phone: 07423232323
42+
phone: 7423232323
4043
}
4144
});
45+
4246
mock.id // ""
4347
mock.getName() // ""
44-
mock.details // "{phone: 07423232323} "
48+
mock.details // { phone: 7423232323 }
4549
```

0 commit comments

Comments
 (0)