diff --git a/curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.english.md b/curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.english.md
index b697d6d3f7..c79b0f970d 100644
--- a/curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.english.md
+++ b/curriculum/challenges/english/05-apis-and-microservices/apis-and-microservices-projects/file-metadata-microservice.english.md
@@ -6,6 +6,7 @@ forumTopicId: 301506
---
## Description
+
Build a full stack JavaScript app that is functionally similar to this: https://file-metadata.freecodecamp.repl.co/.
Working on this project will involve you writing your code on Repl.it on our starter project. After completing this project you can copy your public Repl.it URL (to the homepage of your app) into this screen to test it! Optionally you may choose to write your project on another platform but it must be publicly visible for our testing.
@@ -13,32 +14,62 @@ Start this project on Repl.it using
## Tests
+
```yml
tests:
+ - text: I can provide my own project, not the example URL.
+ testString: "getUserInput => {
+ assert(!(new RegExp('.*/file-metadata.freecodecamp.repl.co')).test(getUserInput('url')));
+ }"
- text: I can submit a form that includes a file upload.
- testString: ''
+ testString: "async getUserInput => {
+ const site = await fetch(getUserInput('url'));
+ const data = await site.text();
+ const doc = new DOMParser().parseFromString(data, 'text/html');
+ assert(doc.querySelector('input[type=\"file\"]'));
+ }"
- text: The form file input field has the name
attribute set to upfile
.
- testString: ''
+ testString: "async getUserInput => {
+ const site = await fetch(getUserInput('url'));
+ const data = await site.text();
+ const doc = new DOMParser().parseFromString(data, 'text/html');
+ assert(doc.querySelector('input[name=\"upfile\"]'));
+ }"
- text: When I submit something, I will receive the file name
, type
, and size
in bytes within the JSON response.
- testString: ''
+ testString: "async getUserInput => {
+ const formData = new FormData();
+ const fileData = await fetch('https://cdn.freecodecamp.org/weather-icons/01d.png');
+ const file = await fileData.blob();
+ formData.append('upfile', file, 'icon');
+ const data = await fetch(getUserInput('url') + '/api/fileanalyse', {
+ method: 'POST', body: formData
+ });
+ const parsed = await data.json();
+ assert.property(parsed, 'size');
+ assert.equal(parsed.name, 'icon');
+ assert.equal(parsed.type, 'image/png');
+ }"
```
## Challenge Seed
+
## Solution
+