azure-mock 4.4.0 → 4.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -16
- package/dist/index.d.ts +1124 -0
- package/dist/index.js +1330 -0
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
[![NPM downloads][badge-npm-downloads]][url-npm]
|
|
6
6
|
[![NPM Unpacked Size (with version)][badge-npm-unpacked-size]][url-npm]
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
It provides mock Azure service classes for local development and testing. They are in-memory implementations of the Azure Table Storage, Blob Storage, Service Bus and EventGrid clients, and they mirror the real Azure SDK interfaces.
|
|
9
9
|
|
|
10
10
|
Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/openspec/specs).
|
|
11
11
|
|
|
@@ -19,6 +19,8 @@ Design notes live in [the specs](https://github.com/Esposter/Esposter/tree/main/
|
|
|
19
19
|
|
|
20
20
|
## <a name="getting-started">🚀 Getting Started</a>
|
|
21
21
|
|
|
22
|
+
Install the package and its Azure peer packages as dev dependencies:
|
|
23
|
+
|
|
22
24
|
```bash
|
|
23
25
|
pnpm i -D azure-mock @azure/core-http-compat @azure/core-rest-pipeline @azure/data-tables @azure/eventgrid @azure/search-documents @azure/service-bus @azure/storage-blob @azure/storage-queue
|
|
24
26
|
```
|
|
@@ -34,24 +36,24 @@ await mockTableClient.upsertEntity({ partitionKey: "pk", rowKey: "rk", value: 42
|
|
|
34
36
|
const entity = await mockTableClient.getEntity("pk", "rk");
|
|
35
37
|
```
|
|
36
38
|
|
|
37
|
-
Replace real Azure
|
|
39
|
+
Replace each real Azure client with its mock equivalent. Make the replacement in your test setup or in your local `.env` configuration.
|
|
38
40
|
|
|
39
41
|
## <a name="key-exports">🧩 Key Exports</a>
|
|
40
42
|
|
|
41
|
-
| Class | Azure Equivalent | Description
|
|
42
|
-
| ------------------------------ | -------------------------- |
|
|
43
|
-
| `MockBlobBatchClient` | `BlobBatchClient` | In-memory batched blob deletion
|
|
44
|
-
| `MockBlobClient` | `BlobClient` | In-memory blob read, copy and delete
|
|
45
|
-
| `MockBlockBlobClient` | `BlockBlobClient` | In-memory block blob upload and download
|
|
46
|
-
| `MockContainerClient` | `ContainerClient` | In-memory blob container, listing and paging
|
|
47
|
-
| `MockEventGridPublisherClient` | `EventGridPublisherClient` | In-memory EventGrid publisher
|
|
48
|
-
| `MockQueueClient` | `QueueClient` | In-memory Azure Storage Queue
|
|
49
|
-
| `MockSearchClient` | `SearchClient` | In-memory Azure AI Search index
|
|
50
|
-
| `MockServiceBusSender` | `ServiceBusSender` | In-memory Azure Service Bus
|
|
51
|
-
| `MockTableClient` | `TableClient` | In-memory Azure Table Storage
|
|
52
|
-
| `MockWebPubSubServiceClient` | `WebPubSubServiceClient` |
|
|
53
|
-
|
|
54
|
-
Each client
|
|
43
|
+
| Class | Azure Equivalent | Description |
|
|
44
|
+
| ------------------------------ | -------------------------- | ------------------------------------------------------------------------------------------ |
|
|
45
|
+
| `MockBlobBatchClient` | `BlobBatchClient` | In-memory batched blob deletion |
|
|
46
|
+
| `MockBlobClient` | `BlobClient` | In-memory blob read, copy and delete |
|
|
47
|
+
| `MockBlockBlobClient` | `BlockBlobClient` | In-memory block blob upload and download |
|
|
48
|
+
| `MockContainerClient` | `ContainerClient` | In-memory blob container, listing and paging |
|
|
49
|
+
| `MockEventGridPublisherClient` | `EventGridPublisherClient` | In-memory EventGrid publisher |
|
|
50
|
+
| `MockQueueClient` | `QueueClient` | In-memory Azure Storage Queue |
|
|
51
|
+
| `MockSearchClient` | `SearchClient` | In-memory Azure AI Search index |
|
|
52
|
+
| `MockServiceBusSender` | `ServiceBusSender` | In-memory Azure Service Bus |
|
|
53
|
+
| `MockTableClient` | `TableClient` | In-memory Azure Table Storage |
|
|
54
|
+
| `MockWebPubSubServiceClient` | `WebPubSubServiceClient` | In-memory group membership: `group().addUser` and `removeUser`; `sendToAll` reaches nobody |
|
|
55
|
+
|
|
56
|
+
Each client stores its state in an exported `Mock*Database` map, such as `MockTableDatabase` or `MockContainerDatabase`. To reset a test, clear the map that the test seeded.
|
|
55
57
|
|
|
56
58
|
## <a name="license">⚖️ License</a>
|
|
57
59
|
|