eykrehbein / strest

⚡️ CI-ready tests for REST APIs configured in YAML
MIT License
1.74k stars 59 forks source link

Using Moment.js or something similar #119

Open bondsgame101 opened 5 years ago

bondsgame101 commented 5 years ago

I am trying to dynamically produce the current day in a test. Faker will not allow me to format for the required post data that I need. I know of moment.js and day.js that will produce this and allow me to format the data. I have not been able to successfully import either into my test and was wondering if import was possible, if there was something else already built in, or if this is something that could possibly added as feature?

jgroom33 commented 5 years ago

the project uses nunjucks. Looks like there is a filter for moment.js: https://www.npmjs.com/package/nunjucks-date-filter

jgroom33 commented 5 years ago

This would need to be added to the project. There isn't currently a way to import libs. It should be a pretty simple addition to the project. Here's where the dateFilter could be added to the nunjucks env: https://github.com/eykrehbein/strest/blob/master/src/test.ts#L40

shrikster commented 5 years ago

I can take this