Timestamp Microservice - how to test that API?

Timestamp Microservice - how to test that API?
0

Tell us what’s happening:
I created that API Project: Timestamp Microservice with Glitch and I’m wondering how to test it.

The solution can be posted here:
https://learn.freecodecamp.org/apis-and-microservices/apis-and-microservices-projects/timestamp-microservice

In the introtext there is the following sentence:

After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it

My questions:

  1. that “Solution” field ist for the glitch project homepage?
  2. why is that “Github Link” needed? Must all the code from Glitch also be accessible in Github?
  3. whatever I enter into the two fields - eg https://www.google.com, (as far as it is a url), I’ll get to the next page.

Maybe it’s obvious but I just don’t get it how to test that API

Link to the challenge:
https://learn.freecodecamp.org/apis-and-microservices/apis-and-microservices-projects/timestamp-microservice

The glitch link will be the live link, e.g. https://curse-arrow.glitch.me/.
The github is needed so the code can be found, as it would be hard to programatically find the code on glitch. You just need to have all your code on github too.

1 Like

Thanks. I wasn’t aware that code on glitch is only visible if you’re logged in, I was thinking in “codepen-way”. So github is needed to present the code!

Related to “testing” I asume that there is no more automated testing in “Apis and Microservices Projects”. There are not that many test-cases.

yes. And the live demo is only needed when a human reviews the project for certification, as a program wouldn’t need it. Why would it? :wink:

So, is someone actually looking in person at code on GitHub to determine if your answer passes in this section in order to get the certification? I’ve been putting my glitch web address in both boxes to “pass” the tests. But I see according to this question no matter what address you put into the boxes, as long as it is valid, “passes” and you can go on to the next project. Will I not get the certification if it’s not on Github?

I made a test and added some dummy links under
SETTINGS > Apis and Microservices Settings:


That claim certification button will appear.
(the github-links are not visible here)

ps:
I’m thinking about making a overview-page in codepen with a list of glitch-links and corresponding github links. So if someone is interested in that microservices-projects in detail I can send him that codepen link.

There were tests, but they are not working now.
It is obviously a serious bug.

tests:

  • text: ‘It should handle a valid date, and return the correct unix timestamp’
    testString: ‘getUserInput => $.get(getUserInput(’‘url’’) + ‘’/api/timestamp/2016-12-25’’).then(data => { assert.equal(data.unix, 1482624000000, ‘‘Should be a valid unix timestamp’’); }, xhr => { throw new Error(xhr.responseText); })’
  • text: ‘It should handle a valid date, and return the correct UTC string’
    testString: ‘getUserInput => $.get(getUserInput(’‘url’’)+ ‘’/api/timestamp/2016-12-25’’).then(data => { assert.equal(data.utc, ‘‘Sun, 25 Dec 2016 00:00:00 GMT’’, ‘‘Should be a valid UTC date string’’); }, xhr => { throw new Error(xhr.responseText); })’
  • text: ‘It should handle a valid unix date, and return the correct unix timestamp’
    testString: ‘getUserInput => $.get(getUserInput(’‘url’’) + ‘’/api/timestamp/1482624000000’’).then(data => { assert.equal(data.unix, 1482624000000) ; }, xhr => { throw new Error(xhr.responseText); })’
  • text: It should return the expected error message for an invalid date
    testString: ‘getUserInput => $.get(getUserInput(’‘url’’) + ‘’/api/timestamp/this-is-not-a-date’’).then(data => { assert.equal(data.error.toLowerCase(), ‘‘invalid date’’);}, xhr => { throw new Error(xhr.responseText); })’
  • text: ‘It should handle an empty date parameter, and return the current time in unix format’
    testString: ‘getUserInput => $.get(getUserInput(’‘url’’) + ‘’/api/timestamp’’).then(data => { var now = Date.now(); assert.approximately(data.unix, now, 20000) ;}, xhr => { throw new Error(xhr.responseText); })’
  • text: ‘It should handle an empty date parameter, and return the current time in UTC format’
    testString: ‘getUserInput => $.get(getUserInput(’‘url’’) + ‘’/api/timestamp’’).then(data => { var now = Date.now(); var serverTime = (new Date(data.utc)).getTime(); assert.approximately(serverTime, now, 20000) ;}, xhr => { throw new Error(xhr.responseText); })’
  1. Yes. The public glitch url allows fCC to view a live demo of your application. If we try it out and it satisfies all of the user stories given in the project instructions, that’s a first step toward verifying that the person who submitted it has successfully completed the project.

  2. It matters if the person who completed the project uploads their code to GitHub directly from a GitHub-linked Glitch account because their code can then be connected to that public Glitch url showing that that person is the ‘owner’ of the code. We can also clone that repository and run it locally on our machines in developer mode, testing it out as we see fit. It’s a public repository, so anyone can do so. There may even be automated plagiarism checks run on it locally.

  3. Assume submissions will be checked. Submitting inappropriate urls is something that will be quickly and easily caught. The worry that projects are not checked and subsequent certifications will be ‘undeserved’ is understandable, but it’s simply not the case.

From the freeCodeCamp Academic Honesty Policy:

I pledge that I did not plagiarize any of my freeCodeCamp work. I understand that freeCodeCamp’s team will audit my projects to confirm this.

In the situations where we discover instances of unambiguous plagiarism, we will replace the camper in question’s certification with a message that “Upon review, this account has been flagged for academic dishonesty.”

From my own perspective, I want everything I submit to be correct to the testing standards. So, when I submit my work I think it is correct.

For most of us I think we are using freeCodeCamp to learn how to code and cheating to get certificates is not the goal for anyone looking to learn. Especially those of us who hope to get a job doing this for a living. Because if we cheat our way through vs. actually learning we will be called out very easily by prospective employers.

I think the issue being raised here is in most challenges and projects there are tests that pass or fail us. And that lets us know if our code is correct. In this case it seems there is no test of our code. So, I/we think we have the correct code but there is not actually a test of it as usually is done and we don’t have that validation our code is correct. I want to learn and know I have completed the challenges and projects correctly, because if I fail it is a learning opportunity.

I take the freeCodeCamp academic policy seriously, and I want to learn. But if someone cheats their way though the course they are only hurting themselves.

1 Like

I think the point ist the formulation of this sentence:

After completing this project you can copy your public glitch url (to the homepage of your app) into this screen to test it

This reads like: in the moment of submitting there is an automated test and if I submit and come to the next project-page then no problems where found in that test.

@s-projects18 but that is not the case in this instance because you can put in google.com and pass the tests so the “point” of this forum thread is that there are no actual tests run on your project. So, you may have “problems” but there are no tests run so you don’t actually know if your code had problems.

I have opened an issue on Github for this problem.
Please vote for it to draw the attention of the code maintainers.

‘Voting’ is that “thumb-up emoji” under the issue?
(Issues -> ‘Microservices Projects tests don’t work’)

1 Like

Yes. If you didn’t see that there, you would click on the + button to add an emoji, and click the thumbs-up one. It’s already there because I added it.