File tree Expand file tree Collapse file tree 2 files changed +26
-4
lines changed
fixtures/simple-app/fixtures Expand file tree Collapse file tree 2 files changed +26
-4
lines changed Original file line number Diff line number Diff line change 1
1
[{
2
2
"id" : " 1" ,
3
- "name" : " Transaction 1" ,
3
+ "name" : " Transaction 1 (inv1) " ,
4
4
"storeId" : " A" ,
5
5
"invoiceId" : " 1"
6
6
}, {
7
7
"id" : " 2" ,
8
- "name" : " Transaction 2" ,
8
+ "name" : " Transaction 2 (inv1) " ,
9
9
"storeId" : " A" ,
10
10
"invoiceId" : " 1"
11
11
}, {
12
12
"id" : " 3" ,
13
- "name" : " Transaction 3" ,
13
+ "name" : " Transaction 3 (inv2) " ,
14
14
"storeId" : " B" ,
15
15
"invoiceId" : " 2"
16
16
}, {
17
17
"id" : " 4" ,
18
- "name" : " Transaction 4" ,
18
+ "name" : " Transaction 4 (inv2) " ,
19
19
"storeId" : " B" ,
20
20
"invoiceId" : " 2"
21
21
}]
Original file line number Diff line number Diff line change @@ -64,6 +64,28 @@ describe('REST API', function() {
64
64
65
65
users . forEach ( user => {
66
66
describe ( `${ user . username } (User with ${ user . abilities . join ( ', ' ) } permissions):` , function ( ) {
67
+ // related group content
68
+ describe ( 'related group content' , function ( ) {
69
+ if ( _includes ( user . abilities , 'read' ) ) {
70
+ it ( 'should fetch an invoices related transactions from the same team' , function ( ) {
71
+ return logInAs ( user . username )
72
+ . then ( res => json ( 'get' , `/api/invoices/1/transactions?access_token=${ res . body . id } ` )
73
+ . expect ( 200 ) )
74
+ . then ( res => {
75
+ expect ( res . body ) . to . be . an ( 'array' ) ;
76
+ expect ( res . body ) . to . have . length ( 2 ) ;
77
+ expect ( res . body [ 0 ] ) . to . have . property ( 'id' , 1 ) ;
78
+ expect ( res . body [ 1 ] ) . to . have . property ( 'id' , 2 ) ;
79
+ } ) ;
80
+ } ) ;
81
+ }
82
+ it ( 'should not fetch an invoice via a relationship from another teams transaction' , function ( ) {
83
+ return logInAs ( user . username )
84
+ . then ( res => json ( 'get' , `/api/transactions/3/invoice?access_token=${ res . body . id } ` )
85
+ . expect ( 401 ) ) ;
86
+ } ) ;
87
+ } ) ;
88
+ // end related group content
67
89
// exists
68
90
describe ( 'exists' , function ( ) {
69
91
if ( _includes ( user . abilities , 'read' ) ) {
You can’t perform that action at this time.
0 commit comments