Comments (7)
I have return 2 test cases for API testing on node side. Its for GET /fiddles/fiddle and POST /save. This test will only test node side like if fiddle is saved in db and correct fiddle is passed to client. I am not sure if this is what you looking for.
I am using mocha, chai and superTest for this.
While writing this test I found some issues I am not sure if its a bug for by Design.
--> Get /fiddles/fiddle should return 404 when fiddle is not found but its returning 200 and a message.
--> When we save same fiddle again it gets saved as another fiddle instead of updating original one.
I have commited my changes to this fork.
let me know if this is was you looking ?
from esfiddle.
@asiyani That's great work, thank you! If you can think of any more test cases to add (even if they fail) then go for it, the more the better! Only 1 thing is to add the npm run test-node
to the npm test
command so it will get run by the CI, but looks good!
The first issue, I will make an issue to fix that, so change the test to expect a 404 error.
The second issue is because we do not have logins for the site, we do not want anyone viewing a fiddle to be able to change it! Resaving functionality will be added once github signins are done.
Submit a PR and I'll merge it in 👍
from esfiddle.
@joshghent I am trying to submit pull request but it failing on travis test
Error message:- LINK
/home/travis/build/esfiddle/esfiddle/node_modules/mongodb/lib/url_parser.js:18
throw new Error('invalid schema, expected mongodb');
for this code....
mongo.connect(String(process.env.MONGODB_URI), function (err, db) { fiddles = db.collection('fiddles'); fiddles.insert(testFiddle); });
but this code is same as in api.js file. not sure why its failing api.test.js.. any idea ?
Thanks.
from esfiddle.
@asiyani I know the issue, submit the PR. It's ok if it's failing for now as we need to fix things like the 404 response etc. Submit the PR and I'll fix it up. I'll have a think of some more tests to add too.
from esfiddle.
Hi
I have submitted pull request.
travis test is still failing with 'Error: invalid schema, expected mongodb'.
Please let me know what is causing this issue.
If you think of any other test let me know.
Thanks
from esfiddle.
@asiyani it's caused by Travis not having the environment variables configured correctly. I'll fix it later, thanks for your PR. I'll take a look at this later
from esfiddle.
Fixed in #36
Thanks to @asiyani for his work and first PR 🎉
from esfiddle.
Related Issues (20)
- Create About Page
- Dark/Light mode switch doesn't update theme dropdown element HOT 2
- Switching from Dark to Light mode and refreshing causes bug
- New Maintainer HOT 13
- Port to GitHub Actions HOT 1
- Fix Embedded View and Create test case HOT 1
- Fix tweet share button HOT 1
- Fix Github gist export HOT 1
- New Code Examples! - On going project! HOT 3
- Improve mobile view HOT 1
- Create github actions Docker pipeline HOT 6
- Create new homepage HOT 1
- Improve fiddle site speed - Multiple PR's welcome! HOT 1
- Change master branch to main HOT 2
- Resolve deprecated dependencies (multiple PR's welcome) HOT 4
- Minify Javascript source HOT 5
- Add Lighthouse CI HOT 2
- Remove unused Javascript HOT 2
- ES7 -2017 - Async-await best practice example HOT 4
- esfiddle.net website is not working HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from esfiddle.