@@ -2,31 +2,31 @@ import { sinon, expect, fetchMock } from "../test-helper"
2
2
import { Person , Author , Book } from "../fixtures"
3
3
import { IResultProxy } from "../../src/proxies/index"
4
4
5
- afterEach ( ( ) => {
6
- fetchMock . restore ( )
7
- } )
8
-
9
- let responsePayload = ( firstName : string ) => {
10
- return {
11
- data : {
12
- id : "1" ,
13
- type : "people" ,
14
- attributes : { firstName }
15
- }
16
- }
17
- }
18
-
19
- beforeEach ( ( ) => {
20
- let url = "http://example.com/api/v1/authors"
21
- fetchMock . post ( url , responsePayload ( 'John' ) )
22
- fetchMock . put ( `${ url } /1` , responsePayload ( 'Jake' ) )
23
- } )
24
-
25
5
// This is a Vue-specific test. Since isPersisted is already true,
26
6
// Vue will prevent the setter from firing. We cannot rely on
27
7
// side-effect behavior of model.isPersisted = true
28
8
// So, ensure we at least call reset() explicitly
29
9
describe ( "Dirty tracking" , ( ) => {
10
+ let responsePayload = ( firstName : string ) => {
11
+ return {
12
+ data : {
13
+ id : "1" ,
14
+ type : "people" ,
15
+ attributes : { firstName }
16
+ }
17
+ }
18
+ }
19
+
20
+ afterEach ( ( ) => {
21
+ fetchMock . restore ( )
22
+ } )
23
+
24
+ beforeEach ( ( ) => {
25
+ let url = "http://example.com/api/v1/authors"
26
+ fetchMock . post ( url , responsePayload ( 'John' ) )
27
+ fetchMock . put ( `${ url } /1` , responsePayload ( 'Jake' ) )
28
+ } )
29
+
30
30
describe ( "when persisted, dirty, updated" , ( ) => {
31
31
it ( "calls reset()" , async ( ) => {
32
32
let instance = new Author ( { firstName : 'John' } )
0 commit comments