Skip to content

Commit 3e6b4a9

Browse files
committed
refactor: simplify PaystackTest by removing commented-out code and improving HTTP fake request
1 parent c175e9c commit 3e6b4a9

File tree

1 file changed

+15
-38
lines changed

1 file changed

+15
-38
lines changed

tests/Paystack/PaystackTest.php

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -86,41 +86,18 @@
8686
]);
8787
});
8888

89-
//it('can make fake http request to get list of banks', function () {
90-
// $body = file_get_contents(__DIR__.'/Fixtures/banks.json');
91-
//
92-
// Http::fake([
93-
// 'https://api.paystack.co/bank' => Http::response($body, 200),
94-
// ]);
95-
//
96-
// // assert if there is a bank with name "Abbey Mortgage Bank" in the list of banks
97-
//// $body =
98-
//
99-
//
100-
//// expect(json_decode($body, true)['data'])
101-
//// ->toBeArray()
102-
////// ->dd()
103-
//// ->toContain(fn ($bank) => $bank['name'] === 'Abbey Mortgage Bank');
104-
//
105-
//// expect(
106-
//// collect(json_decode($body, true)['data'])
107-
//// ->where('name', 'Abbey Mortgage Bank')
108-
//// ->isNotEmpty()
109-
//// )
110-
//// ->toBeTrue();
111-
//
112-
//
113-
//
114-
//// expect($body)
115-
//// ->toBeString()
116-
//// ->toContain('Abbey Mortgage Bank');
117-
//
118-
//// expect(json_decode($body, true))
119-
//// ->toBeArray()
120-
//// ->toHaveKeys([
121-
//// 'status',
122-
//// 'message',
123-
//// 'data',
124-
//// ])
125-
//// ->toContain('data');
126-
//});
89+
it('can make fake http request to get list of banks', function () {
90+
$body = file_get_contents(__DIR__ . '/../Fixtures/banks.json');
91+
92+
Http::fake([
93+
'https://api.paystack.co/bank' => Http::response($body),
94+
]);
95+
96+
expect(json_decode($body, true))
97+
->toBeArray()
98+
->toHaveKeys([
99+
'status',
100+
'message',
101+
'data',
102+
]);
103+
});

0 commit comments

Comments
 (0)