| Conditions | 5 | 
| Total Lines | 37 | 
| Code Lines | 28 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 0 | ||
| 1 | package pagination  | 
            ||
| 5 | func TestExtractFromQueryParam(t *testing.T) { | 
            ||
| 6 | 	type args struct { | 
            ||
| 7 | uri string  | 
            ||
| 8 | }  | 
            ||
| 9 | 	tests := []struct { | 
            ||
| 10 | name string  | 
            ||
| 11 | args args  | 
            ||
| 12 | wantLastID string  | 
            ||
| 13 | wantErr bool  | 
            ||
| 14 | 	}{ | 
            ||
| 15 | 		{ | 
            ||
| 16 | name: "test extracts correct parameter",  | 
            ||
| 17 | 			args: args{ | 
            ||
| 18 | "https://api.mollie.com/v2/payments?from=tr_EkceGSH8Ga&limit=5",  | 
            ||
| 19 | },  | 
            ||
| 20 | wantLastID: "tr_EkceGSH8Ga",  | 
            ||
| 21 | wantErr: false,  | 
            ||
| 22 | },  | 
            ||
| 23 | 		{ | 
            ||
| 24 | name: "test wrong url error parameter",  | 
            ||
| 25 | 			args: args{ | 
            ||
| 26 | "h%%s12",  | 
            ||
| 27 | },  | 
            ||
| 28 | wantLastID: "",  | 
            ||
| 29 | wantErr: true,  | 
            ||
| 30 | },  | 
            ||
| 31 | }  | 
            ||
| 32 | 	for _, tt := range tests { | 
            ||
| 33 | 		t.Run(tt.name, func(t *testing.T) { | 
            ||
| 34 | gotLastID, err := ExtractFromQueryParam(tt.args.uri)  | 
            ||
| 35 | t.Log(err)  | 
            ||
| 36 | 			if (err != nil) != tt.wantErr { | 
            ||
| 37 | 				t.Errorf("ExtractFromQueryParam() error = %v, wantErr %v", err, tt.wantErr) | 
            ||
| 38 | return  | 
            ||
| 39 | }  | 
            ||
| 40 | 			if gotLastID != tt.wantLastID { | 
            ||
| 41 | 				t.Errorf("ExtractFromQueryParam() = %v, want %v", gotLastID, tt.wantLastID) | 
            ||
| 42 | }  | 
            ||
| 46 |