Skip to main content

Functions​

putItem()​

putItem(tableName, item): Promise<void>

Defined in: dynamo-db/put-item.ts:29

Inserts or replaces an item in a DynamoDB table.

Useful for setting up test fixtures in E2E and integration tests. Use this to seed test data before triggering the flow you want to test.

Parameters​

tableName​

string

The name of the DynamoDB table

item​

Record<string, string | boolean | number | object>

The item to insert, containing all attributes

Returns​

Promise<void>

Throws​

Error if the put operation fails

Example​

// Set up test data before running assertions
await putItem('users-table', {
pk: 'USER#123',
sk: 'PROFILE',
name: 'Test User',
email: 'test@example.com',
status: 'PENDING'
});

// Trigger your async flow...
// Then use getItem() to verify the record was updated