thefrontside / simulacrum

A simulation platform for use during testing, during development and for high-fidelity application previews
88 stars 14 forks source link

Prep API and README for testing article #200

Closed cowboyd closed 2 years ago

cowboyd commented 2 years ago

Motivation

There is an article in the works that references the LDAP simulator as a solution to testing a backstage server. Unfortunately, we don't have a README, and so the NPM package homepage looks quite bad.

Approach

This adds a basic readme and shows how to start an LDAP server from both a vanilla JavaScript context as well from an Effection context. There is a third way, which is via a simulacrum server, but this does not add that since it's a bit more fiddly, likely to change, and not relevant for the content of the blog post.

It also adds the actual vanilla javascript integration since it didn't exist before (it just wraps the resource in a run);

netlify[bot] commented 2 years ago

Deploy Preview for simulacrum canceled.

Name Link
Latest commit 3c277f2183a1c1e67891b6ba72d56147c02496bb
Latest deploy log https://app.netlify.com/sites/simulacrum/deploys/62556e990ca58d00090da023
taras commented 2 years ago

I'm going to approve but one thing that is missing, is how to actually get data into the ldap server. An ldap server without data won't be much use.

It does actually show passing data via users property when starting the server, but it's not called out in the description so it's easy to miss.

We might want to add an API for this in the future, something like this.

const ldap = yield runLDAPServer();
yield ldap.createUser({ ... });
dagda1 commented 2 years ago

[It does actually show]

I mean there is nothing in the README

taras commented 2 years ago

I think it is, but the code formatting is broken

image

I just pushed a commit to fix the formatting.