|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace ArkEcosystem\Tests\Client\API; |
| 6 | + |
| 7 | +use ArkEcosystem\Client\ArkClient; |
| 8 | + |
| 9 | +it('calls correct url for all', function () { |
| 10 | + $this->assertResponse('GET', 'tokens', function (ArkClient $client) { |
| 11 | + return $client->tokens()->all(); |
| 12 | + }); |
| 13 | +}); |
| 14 | + |
| 15 | +it('calls correct url for all with whitelist', function () { |
| 16 | + $this->assertResponse( |
| 17 | + 'POST', |
| 18 | + 'tokens', |
| 19 | + function (ArkClient $client) { |
| 20 | + return $client->tokens()->all([ |
| 21 | + 'whitelist' => ['0x1234567890abcdef1234567890abcdef12345678'], |
| 22 | + ]); |
| 23 | + }, |
| 24 | + expectedRequestBody: [ |
| 25 | + 'whitelist' => ['0x1234567890abcdef1234567890abcdef12345678'], |
| 26 | + ] |
| 27 | + ); |
| 28 | +}); |
| 29 | + |
| 30 | +it('sends all whitelist values in the request body', function () { |
| 31 | + $this->assertResponse( |
| 32 | + 'POST', |
| 33 | + 'tokens', |
| 34 | + function (ArkClient $client) { |
| 35 | + return $client->tokens()->all([ |
| 36 | + 'whitelist' => [ |
| 37 | + '0x1234567890abcdef1234567890abcdef12345678', |
| 38 | + '0xabcdef1234567890abcdef1234567890abcdef12', |
| 39 | + ], |
| 40 | + ]); |
| 41 | + }, |
| 42 | + expectedRequestBody: [ |
| 43 | + 'whitelist' => [ |
| 44 | + '0x1234567890abcdef1234567890abcdef12345678', |
| 45 | + '0xabcdef1234567890abcdef1234567890abcdef12', |
| 46 | + ], |
| 47 | + ] |
| 48 | + ); |
| 49 | +}); |
| 50 | + |
| 51 | +it('calls correct url for whitelist with query', function () { |
| 52 | + $this->assertResponse('GET', 'tokens/whitelist?page=2&limit=10', function (ArkClient $client) { |
| 53 | + return $client->tokens()->whitelist([ |
| 54 | + 'page' => 2, |
| 55 | + 'limit' => 10, |
| 56 | + ]); |
| 57 | + }); |
| 58 | +}); |
| 59 | + |
| 60 | +it('calls correct url for get', function () { |
| 61 | + $this->assertResponse('GET', 'tokens/dummy', function (ArkClient $client) { |
| 62 | + return $client->tokens()->get('dummy'); |
| 63 | + }); |
| 64 | +}); |
| 65 | + |
| 66 | +it('calls correct url for holders', function () { |
| 67 | + $this->assertResponse('GET', 'tokens/dummy/holders', function (ArkClient $client) { |
| 68 | + return $client->tokens()->holders('dummy'); |
| 69 | + }); |
| 70 | +}); |
| 71 | + |
| 72 | +it('calls correct url for transfers by token', function () { |
| 73 | + $this->assertResponse('GET', 'tokens/dummy/transfers', function (ArkClient $client) { |
| 74 | + return $client->tokens()->transfersByToken('dummy'); |
| 75 | + }); |
| 76 | +}); |
| 77 | + |
| 78 | +it('calls correct url for all transfers', function () { |
| 79 | + $this->assertResponse('GET', 'tokens/transfers', function (ArkClient $client) { |
| 80 | + return $client->tokens()->transfers(); |
| 81 | + }); |
| 82 | +}); |
| 83 | + |
| 84 | +it('calls correct url for whitelist', function () { |
| 85 | + $this->assertResponse('GET', 'tokens/whitelist', function (ArkClient $client) { |
| 86 | + return $client->tokens()->whitelist(); |
| 87 | + }); |
| 88 | +}); |
0 commit comments