bentonam / fakeit

Generates JSON documents based on models defined in YAML and adds them to a Couchbase Bucket
MIT License
86 stars 21 forks source link

Solves Issue #153 #170

Closed AlexRamey closed 6 years ago

AlexRamey commented 6 years ago

Input:

name: Candies
type: object
key: _id
data:
  count: 2
  pre_run: |
    globals.counter = 2
  post_build: |
    globals.counter = globals.counter - 1 
properties:
  _id:
    type: string
    description: The document id
    data:
      value: candy1
  animals:
    type: array
    description: An array of runway ids that belong to the airport
    data:
      build: |
        const results = [];
        num = 10 * globals.counter;
        for (let i = 0; i < num; i++) {
          results.push("this is a really long string!");
        }
        return results;

Previous Output:

{
  "_id": "candy1",
  "animals": [
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!"
  ]
}"this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!"
  ]
}

New Output:

{
  "_id": "candy1",
  "animals": [
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!",
    "this is a really long string!"
  ]
}
AlexRamey commented 6 years ago

once I got into the npm link, make build, make test workflow I was in business. New to javascript so it took some time to get used to the dev environment

AlexRamey commented 6 years ago

@tjbenton tests are passing locally.

Is there something I should do on my end to kick off the travis builds?

tjbenton commented 6 years ago

@AlexRamey It looks like travis got turned off for pull requests. I'm not sure how that happened but I just turned it back on so go ahead and change var built_docs_map = {}; to be let built_docs_map = {}; then commit it and hopefully it kicks off another build.

coveralls commented 6 years ago

Coverage Status

Changes Unknown when pulling ffb641d24074447f4c181bd39e16a8c2444305cb on AlexRamey:bugfix/issue153/no-duplicate-doc-keys into on bentonam:dev.