peak-ai / jedlik

DynamoDB ODM for Node
MIT License
106 stars 4 forks source link

UPDATED to refactor to be able to switch out data-source #2

Closed EwanValentine closed 4 years ago

EwanValentine commented 5 years ago
const mockClient = jedlik.MockClient({
  item: singleTestItem.
  list: arrayOfTestItems,
  createError: mockCreateError,
  updateError: mockUpdateError,
  deleteError: mockDeleteError,
});

const Model = jedlik.Model({
  table: 'test',
  client: mockClient,
});

class Customer extends Model {
  constructor({ id, name }) {
    this.id = id;
    this.name = name;
  }
}

This will interact with the test data instead of DynamoDB.

Steps to test

  1. Run tests
  2. Point a repo that uses this library at this, cloned locally and checked out to this branch. You can use file:../jedlik in the package.json.
  3. Run the tests in that repo.
  4. Check that the return types match what is expected in projects that use this library.
harrim91 commented 4 years ago

I guess this is redundant now so I'm going to close it