id
int64
776k
1.81M
name
stringlengths
18
45
type
stringclasses
1 value
problem_statement
stringlengths
1.05k
6.2k
project_url
stringlengths
122
130
sub_type
stringclasses
12 values
test_command
stringclasses
7 values
testcases
stringlengths
149
2.7k
testcase_files
stringclasses
7 values
total_testcases
int64
1
17
776,090
React: Cyclic Counter
fullstack
Overview In this task , the goal is to build a simple cyclic counter component . The component must be rendered as <button> with text content corresponding to the current count . Initially , the count is always 0. The component receives a prop cycle defining the counting cycle . After the component is clicked with the mouse , the count value is incremented by one , and if it reaches the value cycle , it is reset to 0 instead . Please see the below animation to see how this is supposed to work when the given cycle value is 4. User Interface Elements The project is initially filled with boilerplate code with the following elements in the interface . Their properties and behavior must be defined as given . Each of these elements must have the given data-testid property , which will be used while testing the solution . The <button> rendered by CycleCount component: - data-testid : cycle-counter - initial text content: 0 Expected Behavior Clicking on <button> rendered by the CycleCount component must result in the appropriate user interface changes: - If the text content of <button> before the click was integer k , then it is updated to k + 1, unless k + 1 = cycle , in which case , it is reset to 0 instead .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/81c5im1sb5n/stack/81c5im1sb5n/c1664bc920b2ef0e609b3b1894e6f7a6.zip
reactjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "junit.xml", "name": "Testing for cycle length 1", "type": "junit", "weight": 0.001}, {"file": "junit.xml", "name": "Testing for cycle length 2", "type": "junit", "weight": 0.249}, {"file": "junit.xml", "name": "Testing for cycle length 3", "type": "junit", "weight": 0.25}, {"file": "junit.xml", "name": "Testing for cycle length 7", "type": "junit", "weight": 0.25}, {"file": "junit.xml", "name": "Testing for cycle length 31", "type": "junit", "weight": 0.25}]
['junit.xml']
5
776,608
React: Text Editor
fullstack
Overview In this task , the goal is to build a very simple text editor . User Interface Elements The project is initially filled with boilerplate code with the following elements in the interface . Their properties and behavior must be defined asgiven . Each of these elements must have the given data-testid property , which will be used while testing the solution . Text Field - data-testid : text-field - initial text content: """", i . e . empty string Word Input - data-testid : word-input - initial value: """", i . e . empty string Append Button - data-testid : append-button - disabled when the Word Input is empty Undo Button - data-testid : undo-button - disabled when the current text content of the editor is empty Expected Behavior When the Word Input has a non-empty value and the Append Button is clicked , the Word Input is emptied so its value becomes """". Additionally , the word typed in the input must appear in the content of Text Field as the last word , where the content of the Text Field consists of all typed words that have not been undone , joined by a single space character . When the Undo Button is clicked , the last appended and not already undone word from the content of the Text Field is removed (along with the space character preceding it if it exists).
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/bf1d60a8a9s/stack/bf1d60a8a9s/5f3fbe80ee65c8b2e14e9dc7e0411483.zip
reactjs
npm test
[{"file": "junit.xml", "name": "Initial UI renders correctly", "type": "junit", "weight": 0.1111111111111111}, {"file": "junit.xml", "name": "Append button becomes enabled when the word input is non-empty", "type": "junit", "weight": 0.1111111111111111}, {"file": "junit.xml", "name": "Append button becomes disabled when the word input is emptied", "type": "junit", "weight": 0.1111111111111111}, {"file": "junit.xml", "name": "Undo button becomes enabled when the text is not empty", "type": "junit", "weight": 0.1111111111111111}, {"file": "junit.xml", "name": "Undo button becomes disabled when the text is emptied", "type": "junit", "weight": 0.1111111111111111}, {"file": "junit.xml", "name": "Word input is emptied when the word is appended", "type": "junit", "weight": 0.1111111111111111}, {"file": "junit.xml", "name": "Append appends words correctly to text", "type": "junit", "weight": 0.1111111111111111}, {"file": "junit.xml", "name": "Undo removes the last appended word correctly from text", "type": "junit", "weight": 0.1111111111111111}, {"file": "junit.xml", "name": "Appending after undo appends correctly", "type": "junit", "weight": 0.1111111111111111}]
['junit.xml']
9
776,661
React: Filtered Employees List
fullstack
Overview In this task , the goal is to build a very simple list of employees , showing their names only , that can be filtered using a text input . User Interface Elements The project is initially filled with boilerplate code with the following elements in the interface . Their properties and behavior must be defined asgiven . Each of these elements must have the given data-testid property , which will be used while testing the solution . Filter Input - data-testid : filter-input - initial value: """", i . e . empty string Each employee must be rendered as an element with data-testid = 'employee' and have its text content equal to the employee name . Expected Behavior The component EmployeesList receives a prop employees , which is an array of employees objects , each containing a single property name denoting the name of that employee . When the Filter Input has an empty string as its value , then all employees must be rendered in the order they are given . Otherwise , let query be the value of the Filter Input , transformed to lowercase . Then , only employees whose lowercased names contain query as their substring must be rendered , preserving the order in which they are given in the array of all employees . Notice that matching employees' names to a query is case insensitive here .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/1542945flee/stack/1542945flee/82a559cc7b32f2ab9e9a1e1eed91bc38.zip
reactjs
npm test
[{"file": "junit.xml", "name": "Initial UI renders correctly", "type": "junit", "weight": 0.16666666666666666}, {"file": "junit.xml", "name": "Filtering for not matching phrase shows no emplyees", "type": "junit", "weight": 0.16666666666666666}, {"file": "junit.xml", "name": "Filtering for not matching phrase that contains at least one name as a proper substring shows no employees", "type": "junit", "weight": 0.16666666666666666}, {"file": "junit.xml", "name": "Filtering for one character query renders correct matches", "type": "junit", "weight": 0.16666666666666666}, {"file": "junit.xml", "name": "Filtering for expected matches with lower and uppercase matched substrings", "type": "junit", "weight": 0.16666666666666666}, {"file": "junit.xml", "name": "Filtering with query containing uppercase letters renders correct matches", "type": "junit", "weight": 0.16666666666666666}]
['junit.xml']
6
777,461
React: Language Translator
fullstack
Overview In this task , the goal is to build a very simple language translator . This translator takes a translations Map object as a prop , and renders one text input field and one read-only text field for the translation output . Once a translatable word is typed in the input , the corresponding translation is shown in the output field . Otherwise , the output field is empty . User Interface Elements The project is initially filled with boilerplate code with the following elements in the interface . Their properties and behavior must be defined asgiven . Each of these elements must have the given data-testid property , which will be used while testing the solution . Input Text - data-testid : text-input - initial value: """", i . e . empty string Output Text - data-testid : text-output - readOnly Expected Behavior The component Translator receives a prop translations , which is a Map from input words to their translations . Once a word is typed in the input for which a translation exists in the translations Map , the corresponding translation must be shown in the output field . Otherwise , the output field must be empty .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/232arg5een1/stack/232arg5een1/a1d74d3a74699d3646eff2834aec98ff.zip
reactjs
npm test
[{"file": "junit.xml", "name": "Initial UI renders correctly", "type": "junit", "weight": 0.2}, {"file": "junit.xml", "name": "Test with existing translations", "type": "junit", "weight": 0.2}, {"file": "junit.xml", "name": "Test with non-existing translations", "type": "junit", "weight": 0.2}, {"file": "junit.xml", "name": "Test with existing translation followed by non-existing translations", "type": "junit", "weight": 0.2}, {"file": "junit.xml", "name": "Test with non-existing translation followed by existing translations", "type": "junit", "weight": 0.2}]
['junit.xml']
5
785,170
React: Using APIs - Paginated Articles
fullstack
Overview In this task , the goal is to create a simple application using the JavaScript Fetch API to fetch a paginated list of articles and render their titles on a selected page in an unordered list . User Interface Elements Your task is to complete the implementation of src/components/Articles . js . The file is initially filled with boilerplate code with the following elements in the interface . Their properties and behavior must be defined asgiven . Pay attention to the provided data-testid property , which will be used while testing the solution . Expected Behavior On the app load , the application must use JavaScript Fetch API , specifically the fetch function , to perform a GET request to https://jsonmock . hackerrank . com/api/articles ? page=1 . The response will contain a totalpages field that denotes the number of pages of results available , and a data field that is an array of articles on the requested page . You must render as many page buttons as there are number of pages , where each button must contain a text content equal to the page number it corresponds to , from 1 to totalpages . Each button must be rendered as the element <button data-testid=""page-button"">{k}</button> , where {k} is the number of pages the button corresponds to . Each of the articles will contain a title field , and your task is to retrieve all the articles from the response that have a not-null title and are non-empty (i . e ., different from the empty string) and display them as elements <li data-testid=""result-row"">{title}</li> , where {title} is the title of an article , in the order they appear in the data field . Clicking on a page button corresponding to a page with some number (for instance , number 3) must result in using the fetch function to perform a GET request to https://jsonmock . hackerrank . com/api/articles ? page=3 and display the returned articles in the same manner as described above . In other words , clicking on a page number button must cause the rendering of the articles on that page of the results .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/8o80s5801t5/stack/8o80s5801t5/4b7d3477d77dcba2da15d7f00d5369b5.zip
reactjs
npm test
[{"file": "junit.xml", "name": "Renders the correct number of page buttons", "type": "junit", "weight": 0.3333333333333333}, {"file": "junit.xml", "name": "Renders articles correctly on app did mount", "type": "junit", "weight": 0.3333333333333333}, {"file": "junit.xml", "name": "Renders articles correctly after page button click", "type": "junit", "weight": 0.3333333333333333}]
['junit.xml']
3
793,496
React: Sorting Articles
fullstack
Create a basic article sorting application , as shown below . Some core functionalities have already been implemented , but the application is not complete . Application requirements are given below , and the finished application must pass all of the unit tests . Hide animation Show animation The app has one component named Articles . The list of articles to be displayed is already provided in the app . The app must have the following functionalities: The list of articles is passed to the App component as a prop in the form of an array of objects . Each article has the following three properties: title : The title of the article [STRING] upvotes : The number of upvotes for an article [NUMBER] date : The publish date for the article in the format YYYY-MM-DD [STRING] By default , the articles should be displayed in the table ordered by the number of upvotes in descending order . Clicking on the ""Most Upvoted"" button should reorder and display the articles by the number of upvotes in descending order . Clicking on the ""Most Recent"" button should reorder and display the articles by date in descending order . You can assume that each article has a unique publish date and number of upvotes . Your task is to complete the implementation of 'src/App . js' and 'src/components/Articles . js'. The following data-testid attributes are required in the component for the tests to pass: The button to reorder and display the most upvoted articles must have the data-testid attribute ""most-upvoted-link"". The button to reorder and display the most recent articles must have the data-testid attribute ""most-recent-link"". Each article must be rendered inside a<tr> element that has the data-testid attribute ""article"". The title of each article must be rendered in a <td> element that has the data-testid attribute ""article-title"". The number of upvotes of each article must be rendered in a <td> element that has the data-testid attribute ""article-upvotes"". The publish date of each article must be rendered in a<td> element that has the data-testid attribute ""article-date"". Please note that the component has the above data-testid attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/a0a5h2gti15/files/e44e58b10a86079543ac75e6dff57559/project.zip
reactjs_vm
npm test
[{"file": "junit.xml", "name": "Initial articles render correctly", "type": "junit", "weight": 0.25}, {"file": "junit.xml", "name": "Clicking on top renders expected articles", "type": "junit", "weight": 0.25}, {"file": "junit.xml", "name": "Clicking on newest renders expected articles", "type": "junit", "weight": 0.25}, {"file": "junit.xml", "name": "Sequence of navigation clicks renders expected articles", "type": "junit", "weight": 0.25}]
['junit.xml']
4
814,675
Angular: Language Translator
fullstack
Create a Language Translator component , as shown below: Hide animation Show animation This component must have the following functionalities: The component receives a prop TRANSLATIONS , which is a Map from input words to their translations . The component renders one text input field and one read-only text output field for the translated output . Once a word is typed in the input for which a translation exists in the TRANSLATIONS Map , the corresponding translation must be shown in the output field . Otherwise , the output field must be empty . Please note that both the input and output fields are initially empty , and the output field is read-only . The following data-test-id attributes are required in the component for the tests to pass: The input must have the data-test-id attribute 'app-input'. The output must have the data-test-id attribute 'app-output'. Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/7f4d3qc2ane/stack/e17kid0p9k4/46ddb05935c5f4bbc846a386150816ef.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "LanguageTranslator Test with non-existing translation followed by existing translations", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "LanguageTranslator Initial UI is rendered as expected", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "LanguageTranslator Test with existing translations", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "LanguageTranslator Test with non-existing translations", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "LanguageTranslator Test with existing translation followed by non-existing translations", "type": "junit", "weight": 0.2}]
['unit.xml']
5
814,719
Angular: Filtered Employees List
fullstack
Create a Filtered Employees List component , as shown below: Hide animation Show animation The component must have the following functionalities: The component receives a prop employees , which is an array of Employee objects , where each object contains a single property name denoting the name of that employee . The component renders the following: One text input field where the user can type the query string . The list of employee names <ul data-test-id=""filtered-employees""></ul>, such that each employee name is added as a list element <li>{name}</li> to this list (in the order they are given in props). Initially , the input has an empty string as its value , and all the employee names must be rendered in the list . As soon as the query string is typed in the input , only employees whose names contain query as their substring must be rendered , preserving the order in which they are given in the props . If the query string has no matching employee names , then do not render the <ul> list but instead render <div data-test-id=""no-result"">No Results Found</div>. Please note that this element must be rendered only when the filtered list is empty and <ul> is not rendered . Therefore , this div must not be rendered initially on component mount . Please note that query strings are case insensitive . The following data-test-id attributes are required in the component for the tests to pass: The input must have the data-test-id attribute 'app-input'. The <ul> must have the data-test-id attribute 'filtered-employees'. The 'No Results Found' div must have the data-test-id attribute 'no-result'. Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/7ej5qe8oflc/stack/ghdrliidcbc/5fd37b73e6a766208c3be514829202a1.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "FilteredEmployees Sequencing - filter with matching string, then with no matching string, then with matching string", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "FilteredEmployees Filtering for no matching phrase when search string contains name as substring", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "FilteredEmployees Filtering for no matching phrase when search string contains name as substring", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "FilteredEmployees Filtering for expected matches with difference in lower and uppercase", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "FilteredEmployees Filtering for one character query renders correct matches", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "FilteredEmployees Initial UI is rendered as expected", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "FilteredEmployees Filtering for no matching phrase shows No Results div", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "FilteredEmployees Filtering for no matching phrase shows No Results Found div", "type": "junit", "weight": 0.125}]
['unit.xml']
8
821,564
Node.js Express: Recipes Pagination
fullstack
Your company is creating a new Recipe Management app . As the NodeJS developer in the company , you have been given the task to write a basic Express app that fetches the Recipe list from a data-store . The request to the route /recipes returns all the paginated recipes with default values of page and limit . The query parameters that can be used to set the pagination criteria are: page:The page of the resource to be fetched . Defaults to 1. [NUMBER] limit:The number of items to be returned in a single page . Defaults to 3. [NUMBER] Routes /recipes ? page&limit - The route to fetch all the recipes from the data-store . Optional query parameters , page and limit , help in controlling the number and position of recipes sent back as a response by the server . Examples / recipes -a GET request to get all recipes [{ ""id"" : 1, ""name"": ""Crock Pot Roast"" }, { ""id"" : 2, ""name"": ""Roasted Asparagus"" }, { ""id"" : 3, ""name"": ""Curried Lentils and Rice"" } ] /recipes ? page=1&limit=2 [{ ""id"" : 1, ""name"": ""Crock Pot Roast"" }, { ""id"" : 2, ""name"": ""Roasted Asparagus"" } ] /recipes ? page=2&limit=3 This request is for page 2, with the limit set to 3. This fetches 3 recipes starting from page 2. (Because each page has a limit of 3, the second page of results begins with recipe 4.) [ { ""id"" : 4, ""name"": ""Big Night Pizza"" }, { ""id"" : 5, ""name"": ""Cranberry and Apple Stuffed Acorn Squash Recipe"" }, { ""id"" : 6, ""name"": ""Mic's Yorkshire Puds"" } ]
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/f69am57qasl/files/d6c19e92c3760b23c7fca971b3c17ba6/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "express_recipes_pagination Should return 200 for /recipes with default pagination", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_recipes_pagination Should respond with correct data when only page is set in query", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_recipes_pagination Should respond with correct data when only limit is set in query", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_recipes_pagination Should respond with correct data when both limit and page are set in query - 1", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_recipes_pagination Should respond with correct data when both limit and page are set in query - 2", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_recipes_pagination Should respond with correct data when both limit and page are out of bounds", "type": "junit", "weight": 0.16666666666666666}]
['unit.xml']
6
821,568
Node.js Express: Recipe Filter
fullstack
Your company is creating a new Recipe Management app . As the NodeJS developer in the company , you have been given the task to write a basic Express app that automatically creates shopping lists from the Recipes array . The request to the route /recipes/shopping-list ? ids returns a list of all the aggregated ingredients contained in the matching IDs . The query parameter that can be used to set the recipe id is: ids: A comma-separated list of IDs for which the ingredients have to be aggregated . [STRING] The ingredients should only be aggregated for the IDs that match any of the recipe IDs present in the Recipe list , which is contained in the recipes . json file . All the non-matching IDs can be ignored entirely from the response . Each Recipe object has a list of ingredientsstored in theingredientsproperty of the object , as can be seen here: { ""id"" : 1, ""name"": ""Pot Roast"", ""ingredients"": [ { ""quantity"": ""1"", ""name"": "" beef roast"", ""type"": ""Meat"" }, { ""quantity"": ""1 package"", ""name"": ""brown gravy mix"", ""type"": ""Baking"" } ] } Routes /recipes/shopping-list ? ids - The route to fetch all the aggregated ingredients for the matching recipes . The query parameter ids is mandatory , and the server should send a status code 400 if the query parameter ids is blank or not present . If none of the IDs passed match with the IDs present in the data-store , the server should send a status code 404 with 'NOTFOUND' in the body of the response . Examples 1. /recipes/shopping-list Response Status Code - 400 2. /recipes/shopping-list ? ids=asdasd Response Status Code - 404 Body - NOTFOUND 3. /recipes/shopping-list ? ids=3 [ { ""quantity"":""1 quart"", ""name"":""beef broth"", ""type"":""Misc"" }, { ""quantity"":""1 cup"", ""name"":""dried green lentils"", ""type"":""Misc"" }, { ""quantity"":""1/2 cup"", ""name"":""basmati rice"", ""type"":""Misc"" }, { ""quantity"":""1 tsp"", ""name"":""curry powder"", ""type"":""Condiments"" }, { ""quantity"":""1 tsp"", ""name"":""salt"", ""type"":""Condiments"" } ]
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/d6apgemg1lc/files/dfb0fce8465d5aea581768167fc094f3/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "express_recipes_filters Should return 400 for /recipes/shopping-list if no ids are passed in query", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "express_recipes_filters Should respond back with a 404 if none of the ids match", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "express_recipes_filters Should respond with the shopping list if the ids are valid and match is found", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "express_recipes_filters Should respond with the correct shopping if the query sent is mixed", "type": "junit", "weight": 0.25}]
['unit.xml']
4
821,574
Node.js Express: Pagination Middleware
fullstack
Your company is creating a new Recipe Management app . As the NodeJS developer in the company , you have been given the task to write an Express middleware that has to standardize the query , search , and projection parameters for all the endpoints . The middleware should parse the query parameter from the URL and create an object containing the following properties: page:The page of the resource to fetch . Defaults to 1. [NUMBER] limit:The number of items to return in a response . Defaults to 3. [NUMBER] skip:The actual number of items that have to skip while fetching the data . Its value is ((page - 1) limit). [NUMBER] searchTerm: The search term to be used in the data-store query . The term is extracted from the q query parameter . [STRING] search: A Regex expression that can be evaluated to match the names of the items in the recipes . The search should be global and case insensitive (""gi""). [RegexP] The generated object should then be added to the context property in the Express request object , and the control should be forwarded using the next function . Routes /recipes ? page&limit&q - The route to fetch all the recipes from the data-store . Optional query parameters page , limit , and q help in controlling the number and position of recipes sent back as a response by the server . Examples / recipes -a GET request to get all recipes { ""page"":1, ""limit"":3, ""skip"":0, ""data"":[ { ""id"":1, ""name"":""Roast"" }, { ""id"":2, ""name"":""Asparagus"" }, { ""id"":3, ""name"":""Rice"" } ] } /recipes ? page=1&limit=2 { ""page"":1, ""limit"":2, ""skip"":0, ""data"":[ { ""id"":1, ""name"":""Roast"" }, { ""id"":2, ""name"":""Asparagus"" } ] } /recipes ? page=2&limit=3 { ""page"":2, ""limit"":3, ""skip"":3, ""data"":[ { ""id"":4, ""name"":""Pizza"" }, { ""id"":5, ""name"":""Recipe"" }, { ""id"":6, ""name"":""Puds"" } ] } 4. /recipes ? page=1&limit=3&q=cr { ""page"":1, ""limit"":3, ""skip"":0, ""search"":""cr"", ""data"":[ { ""id"":1, ""name"":""Crock"" }, { ""id"":5, ""name"":""Cranberry"" } ] }
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/bcf79pkalq1/files/69062890fcb0a69285ece4da64036837/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "express_pagination_middleware Should have the context object in the request", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_pagination_middleware Should have property id, timestamp, path in trace object", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_pagination_middleware Should have the default page, limit and skip property values", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_pagination_middleware Should set the correct skip value based on page and limit", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_pagination_middleware Should have a valid search property in context object", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_pagination_middleware Should respond with the correct data - 1", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_pagination_middleware Should respond with the correct data - 2", "type": "junit", "weight": 0.14285714285714285}]
['unit.xml']
7
821,579
Node.js Express: Find Recipe Step
fullstack
Your company is creating a new Recipe Management app . As the NodeJS developer in the company , you have been given the task to write a basic Express app that has a single route for fetching a single recipe's current step-index based on the elapsedTime passed as input . The request to the route /recipes/step/:id ? elapsedTime returns the index of the current step of the recipe based on the elapsed time in the format {""index: currentIndex}. If the ID passed in the URL is missing or is not a valid number , the server should respond with the status code 400 and the string message NOTFOUND in the body of the response . If the elapsedTime query parameter is not present in the URL , it should default to 0. Note: Elapsed time should be interpreted as a Number , and the unit of measurement is the same as the unit of measurement for the timers (i . e ., minutes). Each Recipe object has a list of steps , stored in the steps property , and the corresponding timers , stored in the timers property . The steps and timers are two different arrays , but they are interpreted in combination with each other . The time required to finish step 1 (index 0) of the steps array is stored in the 0th index of the timer array . { ""id"": 2, ""name"": ""Roasted Asparagus"", ""steps"": [ ""Preheat oven to 425F ."", ""Cut off the woody bottom part of the asparagus spears and discard ."", ""With a vegetable peeler , peel off the skin on the bottom 2-3 inches of the spears (this keeps the asparagus from being all and if you eat asparagus you know what I mean by that)."", ""Place asparagus on foil-lined baking sheet and drizzle with olive oil ."", ""Sprinkle with salt ."", ""With your hands , roll the asparagus around until they are evenly coated with oil and salt ."", ""Roast for 10-15 minutes , depending on the thickness of your stalks and how tender you like them ."", ""They should be tender when pierced with the tip of a knife ."", ""The tips of the spears will get very brown but watch them to prevent burning ."", ""They are great plain , but sometimes I serve them with a light vinaigrette if we need something acidic to balance out our meal ."" ], ""timers"": [ 0, 0, 0, 0, 0, 0, 10, 0, 0, 0 ] }, Routes /recipes/step/:id ? elapsedTime - The id parameter should be used to filter the results based on the ID of the object provided . If the ID is not valid or is not a valid number , the server should send a status code 400 with 'NOTFOUND' in the body of the response . Examples /recipes/step/4? elapsedTime=11 Outptut - {index: 0} Explanation - The ID of the recipe in the URL is 4. The recipe with ID 4 has the following properties: { ""id"": 4, ""name"": ""Big Night Pizza"", ""steps"": [ ""Add hot water to yeast in a large bowl and let sit for 15 minutes ."", ""Mix in oil , sugar , salt , and flour and let sit for 1 hour ."", ... ], ""timers"": [ 15, 60, ... ] } The elapsed time sent as query param is 11. This roughly translates to , ""Which step will be active for this recipe when 11 minutes have passed after starting the recipe ?"" The step at index 0 has a timer property of 15. So after 11 minutes , step 1 will be the current step , and its index is 0, which is the final output . /recipes/step/wqw Status Code - 400 Body - NOTFOUND
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/6ratfp5ccab/files/1f920626544e1643913fd4aeee58629c/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "express_recipes_routes Should return 400 for /recipes/step/:id if id is not valid", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "express_recipes_routes Should respond with 0 if elapsed time is 0", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "express_recipes_routes Should respond back with the correct step - 1", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "express_recipes_routes Should respond back with the correct step - 2", "type": "junit", "weight": 0.25}]
['unit.xml']
4
821,588
Node.js: Order Processing
fullstack
An eCommerce company is growing rapidly , and stock management is becoming a bottleneck . As the NodeJS developer in the company , you have been given the task to write an Order-Processing Script that takes the order data as input , performs a few pre-order checks/validations , and returns the result . If any line-itemin the order data does not pass the pre-order checks , the order should fail , and the corresponding failure event should be fired . Class Description Create a module , processor . js , and implement the following set of functionalities: The file should export a class OrderProcessor as the default export of the module , and it should inherit from the EventEmitter class . The class should have the following methods: placeOrder :Accepts the order data as an argument and immediately starts performing the validations on it . The orderData passed to the function should have the following properties/shape: [ { ""orderNumber"": ""OD2323"", // Order Number of the order ""lineItems"": [ // Array containing the lineItems in the order { ""itemId"": 3, // ID of the line Item . ""quantity"": 4 // The quantity requested in the order }, { ""itemId"": 5, ""quantity"": 4 } ] } ] The class should emit the following events: PROCESSINGSTARTED: Should be fired just before the validations are started for an order . The order number of the current order should be passed to the callback of the event handler . PROCESSINGFAILED: Should be fired if , for any reason , the pre-order checksdonot pass . The callback of the event handlerwill accept an object containing the following properties: orderNumber: The orderNumber of the order that failed to process . itemId: The ID of the first matching item that failed to process . reason: The reason why the processing failed . It can be one of INSUFFICIENTSTOCK orLINEITEMSEMPTY . If the lineItems property is a blank array , the check should fail with the reasonLINEITEMSEMPTY . The itemId property need not be passed to the errorObject in this scenario . If any of the lineItems ' requested quantity is more than the matching stock property in the stockData array , the check should fail with the reasonINSUFFICIENTSTOCK . PROCESSINGSUCCESS: Should be fired if all the pre-order checkspass . The order number of the current order should be passed to the callback of the event handler . The file containing the current stock information , stock-list . json , is added to the root of the project and can be used for validation . An explanation of an entry in the JSON array is as follows: id : The IDof the item for which stock information is stored . stock : The current stock count of the item . [ { ""id"": 0, ""stock"": 4 }, { ""id"": 1, ""stock"": 12 }, ... ] Note: It can be assumed that lineitems passed to the placeOrder function will always be an array , and the ID of the lineItem passed will always be present in the stock list . No extra code is required for these conditions . Example Implementation const OrderProcessor = require('./order-processor'); const orderProcessor = new OrderProcessor(); orderProcessor . on('PROCESSINGSTARTED', (orderNumber) => { console . log(Pre Order Checks Running for {orderNumber}) }); orderProcessor . on('PROCESSINGFAILED', (failureData) => { console . log(Failed Order); console . log(- OrderNumber: {failureData . orderNumber}); console . log(- Reason: {failureData . reason}); console . log(- ItemId: {failureData . itemId}); }) orderProcessor . on('PROCESSINGSUCCESS', (orderNumber) => { console . log(Pre Order Checks Passed for {orderNumber}) }) orderProcessor . placeOrder({ orderNumber: 'OD2323', lineItems: [ { itemId: 3, quantity: 4 }, { itemId: 5, quantity: 4 } ] });
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/2sedj91ba92/files/73ed3b77b437151d33bb380e23ad90de/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "order_processor \"before each\" hook for \"Should have all the method placeOrder in the class\"", "type": "junit", "weight": 0.5}, {"file": "unit.xml", "name": "order_processor \"after each\" hook for \"Should have all the method placeOrder in the class\"", "type": "junit", "weight": 0.5}]
['unit.xml']
6
821,724
Angular: Text Editor
fullstack
Create a simple Text Editor component , as shown below: Hide animation Show animation The component should have following functionalities- The input should initially be empty . The user can type any text into this input field to append to the output text . Clicking on the 'Append' button should extract the text typed in the input field and append it to the output text at the end , joined by a single space character . If the input is empty , clicking on 'Append' should do nothing . After every append operation , the input should become empty again . Clicking on the 'Undo' button should undo the last append operation (i . e ., remove the last added text from the output , along with the space character preceding the text). Multiple undo operations are possible until the output becomes empty . When the output is empty , clicking on the 'Undo' button should do nothing . The following data-test-id attributes are required in the component for the tests to pass: The input should have the data-test-id attribute 'app-input'. The output should have the data-test-id attribute 'output-field'. The 'Append' button should have the data-test-id attribute 'append-button'. The 'Undo' button should have the data-test-id attribute 'undo-button'. Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/gaag9dg4kh6/stack/93ris1gqr76/70c8a7ca7c270352c94b4f06475d0a80.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "TextEditor Clicking on append should add the text to the output", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "TextEditor Appending after undo appends correctly", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "TextEditor Multiple click on undo works till output becomes empty", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "TextEditor Undo works", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "TextEditor After appending data, input field should have no text", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "TextEditor Nothing should happen when input is empty and append is clicked", "type": "junit", "weight": 0.16666666666666666}]
['unit.xml']
6
821,751
Angular: Top and Newest Articles
fullstack
Create an Articles List component that toggles the order of the articles , as shown below: Hide animation Show animation The component should have the following functionalities: The component receives a prop articles , which is an array of objects , where each object has 3 properties: string title , integer upvotes , and date in format YYYY-MM-DD . The component renders all the articles in a table body <tbody> element . Each article should be rendered as a <tr> element inside the table body , and it should contain 3 children <td> elements corresponding to each article's title , upvotes , and date . On component mount , articles should be ordered by the number of upvotes in descending order . Clicking on the 'Newest' button should order the articles by date in descending order . Clicking on the 'Top Upvotes' button should order the articles by the number of upvotes in descending order . It can be assumed that no two articles have the same date value , and no two articles have the same number of upvotes . Tests take care of testing with these assumptions , so no extra validation is required . The following data-test-id attributes are required in the component for the tests to pass: The 'Top Upvotes' button should have the data-test-id attribute 'top-button'. The 'Newest' button should have the data-test-id attribute 'newest-button'. The table body <tbody> should have the data-test-id attribute 'articles-list'. Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/6719j2p0jrq/stack/f27cmrjdtrq/7ab90ab1baa117448a3ecf6cd8e88a5d.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "ArticlesList Initial articles render correctly", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "ArticlesList Clicking on newest renders expected articles", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "ArticlesList Clicking on top renders top articles", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "ArticlesList Sequence of navigation clicks renders expected artices", "type": "junit", "weight": 0.25}]
['unit.xml']
4
821,926
Angular: Cyclic Counter
fullstack
Create a Cyclic Counter component , as shown below: Hide animation Show animation The component should have the following functionalities: The component receives a prop cycle , defining the counting cycle . The component should render a <button> element displaying the text content corresponding to the current count . Initially , count is always 0. On button click , the count value is incremented by one , and if it reaches the value cycle , it is reset to 0 instead . The demo above shows a simple example when the given cycle value is 4. In other words , if the text content of <button> before the click was integer k , then it is updated to k + 1, unless k + 1 = cycle , in which case it is reset to 0 instead . The following data-test-id attributes are required in the component for the tests to pass: The button rendering the current count value should have the data-test-id attribute 'cycle-counter'. Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/30fcj585sid/stack/45h2l701f8d/4a7b9e8b35de08cb8520dce71d5d9ee7.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "CyclicCounter Initial UI is rendered as expected", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "CyclicCounter Testing for cycle length 2", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "CyclicCounter Testing for cycle length 1", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "CyclicCounter Testing for cycle length 7", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "CyclicCounter Testing for cycle length 3", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "CyclicCounter Testing for cycle length 31", "type": "junit", "weight": 0.16666666666666666}]
['unit.xml']
6
822,789
Node.js: Bank Transactions
fullstack
As the NodeJS developer in your company , you have been given the task to write a BankTransactionScript that creates a bank account and allows the user to perform credit and debit transactions . Class Description Create a module , account . js , and implement the following set of functionalities: The file should export a class Account as the default export of the module , and it should inherit from the EventEmitter class . The class should have the following properties , passedto the constructor: accountNumber:The account number for the bank account . [NUMBER] balance: The initial balance in the bank account . [NUMBER] The class should listen forthe following events: debit - argument amount . Perform a debit transaction in the account with the amount passed to the event . If the amount of transaction is greater than the balance of the account , emit the errorINSUFFICIENTBALANCE . Otherwise , deduct the amount from the balance and emit thebalance event . credit - argument amount . Perform a credit transaction in the account with the amount passed to the event . If the amount of transaction is greater than 20000, emit the errorMAXLIMITREACHED . Otherwise , add the amount to the balance and emit thebalance event . The class should emit the following events: balance - Emitted when the balance of the account is updated . The format of the object passed tothe callback is as follows: { balance: this . amount , // The balance of the account accountNumber // The account number of the account } INSUFFICIENTBALANCE - Emitted when the amount of transaction is greater than the balance of the account . MAXLIMITREACHED - Emitted when the credit amount is greater than 20000. Example Implementation const Account = require('./account'); const account1 = new Account(1, 1200); const account2 = new Account(2, 200); account1. on('balance', data => { console . log('n---------- Transaction ---------'); console . log('Account Number :: ', data . accountNumber); console . log('Current Balance ::', data . balance); console . log('---------------------------------n'); }); account2. on('balance', data => { console . log('n---------- Transaction ---------'); console . log('Account Number :: ', data . accountNumber); console . log('Current Balance ::', data . balance); console . log('---------------------------------n'); }); account1. emit('debit', 12); account1. emit('debit', 200); account2. emit('credit', 1200);
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/e28559rfo8m/files/2da2439a3d7e07424fbac0f915ea52ce/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "account_events Should emit the event INSUFFICIENT_BALANCE when a debit event is emitted", "type": "junit", "weight": 0.5}, {"file": "unit.xml", "name": "account_events \"after each\" hook for \"Should emit the event INSUFFICIENT_BALANCE when a debit event is emitted\"", "type": "junit", "weight": 0.5}]
['unit.xml']
5
823,177
Node.js: Async Search
fullstack
As the NodeJS developer in the company , you have been given the task to write an Asynchronous SearchScriptthat takes a search term as input and returns the count of the matching objects or throws an error if the search was unsuccessful . Class Description Create a module , search . js , and implement the following set of functionalities: The file should export a class Search as the default export of the module , and it should inherit from the EventEmitter class . The class should have the following methods: searchCount:Accepts the searchTerm [STRING] as the argument , and it internally makes use of the predefined API service in order to fetch the count of the matches . If the searchTerm passed to the function is undefined , the function should emit the eventSEARCHERROR with an object containing the message property INVALIDTERM , and then immediately return without executing further . { ""message"": ""INVALIDTERM"" } The class should emit the following events: SEARCHSTARTED - Emitted immediately when the searchCount function is called and if searchTerm passed to the function is not undefined . searchTerm should be passed to the callback function of the event handler . SEARCHSUCCESS - Emitted if the countMatches method resolved with a result successfully . The callback function of the event handler should accept an object with the following properties: count: The count of the matches returned by the API . countMatches function term: The search term that was passed to the function SEARCHERROR - Emitted if searchTerm passed to the searchCount function is undefined (as described above) or if the countMatches method rejects with an error . When the countMatches method rejects with an error , the callback function of the event handler should accept an object with the following properties: message: The message property of the error object returned by the API . countMatches method term: The search term passed to the function The API service file , mock-api . js , is present in the root folder of the project and has a single method , countMatches , that accepts searchTerm as input and returns a Promise . The Promiseeither resolves with a counted number of the matches , or itrejects with a JavaScript Error object . To test rejection for this method , you can pass searchTerm 'error' to the countMatches function . Example Implementation const Search = require('./search'); const search = new Search(); search . on('SEARCHSTARTED', (term) => { console . log('Search started for term :', term); }) search . on('SEARCHERROR', (result) => { console . log(Error in search for term ""{result . term}"", result . message); }) search . on('SEARCHSUCCESS', (result) => { console . log(Search Completed for term ""{result . term}"", result . count); }) search . searchCount('error'); search . searchCount(); search . searchCount('test');
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/gapnh7fi0a1/files/22c2db0fbb422a90cc634e5c55d3e4d6/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "async-search \"before each\" hook for \"Should emit the event SEARCH_STARTED when the search starts\"", "type": "junit", "weight": 0.5}, {"file": "unit.xml", "name": "async-search \"after each\" hook for \"Should emit the event SEARCH_STARTED when the search starts\"", "type": "junit", "weight": 0.5}]
['unit.xml']
4
823,438
Node.js Express: Dynamic Router
fullstack
Your company wants to create a new routing framework based on ExpressJS that allows developers to perform file-based routing . A new route can be simply added to the app by creating a new file in the pages folder . The framework reads the pages directory and generates a set of dynamic routes that can be added to Express routing . Consider the pages directory with the following files: - pages -- index . html -- product --- index . html --- slug . html --- product1. html The corresponding generated Express routes should be: Method Route Served File GET / /pages/index . html GET /product/product1 /pages/product/product1. html GET /product/:slug /pages/product/slug . html GET /product /pages/product/index . html Each sub-directory in the pages directory becomes a separate path in the dynamically generated URL . So the product subdirectory generates the route /product . The index . html file of each directory becomes the base HTML file for the route . To generate a route with URL parameters , create the file prefixed with an underscore , like so: /pages/product/slug . html -> product/:slug The module resolver . js is responsible for converting the file structure to the corresponding URL routes . The module should return a Promise as the default export . The Promise should resolve with an array of routes in the following format: [ { ""url"": ""/"", ""file"": ""/index . html"" }, { ""url"": ""/product"", ""file"": ""/product/index . html"" }, { ""url"": ""/product/:slug"", ""file"": ""/product/slug . html"" } ] The program must read the directory pages and generate the URLs . Note that you have to traverseand fetch details only for the immediate children of the pages directory(i . e ., fetch details of files only 1 level deep). Examples Let's say this is the directory structure: - pages -- index . html -- articles --- index . html The module resolver . js should generate the following routes array: [ { ""url"": ""/"", ""file"": ""/index . html"" }, { ""url"": ""/articles"", ""file"": ""/articles/index . html"" } ] Let's say this is the directory structure: - pages -- index . html -- articles --- index . html --- name . html --- name . html -- pictures --- id . html The module resolver . js should generate the following routes array: [ { ""url"": ""/"", ""file"": ""/index . html"" }, { ""url"": ""/articles"", ""file"": ""/articles/index . html"" }, { ""url"": ""/articles/name"", ""file"": ""/articles/name . html"" }, { ""url"": ""/articles/:name"", ""file"": ""/articles/name . html"" }, { ""url"": ""/pictures/:id"", ""file"": ""/pictures/id . html"" } ]
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/74ti7j86k3t/files/98e75b711243821a59ec964de79a5b15/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "express_fancy_router Should create a valid route tree for the base path", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_fancy_router Should create a valid route tree for a dynamic file", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_fancy_router Routing should work correctly for /user/:id route", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_fancy_router Routing should work correctly for /user route", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_fancy_router Routing should work correctly for /user/me route", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_fancy_router Routing should work correctly for /blog route", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_fancy_router Routing should work correctly for base route", "type": "junit", "weight": 0.14285714285714285}]
['unit.xml']
7
830,781
React: Slideshow App
fullstack
Create a basic slideshow application , as shown below . Application requirements are given below , and the finished application must pass all of the unit tests . Hide animation Show animation Your task is to complete the implementation of src/components/Slides . js according to the following requirements: The Slides component takes an array of slides as a prop . Each element of this array denotes a single slide and is an object with2properties: string title and string text . On application launch , the first slide must be rendered . Clicking on the ""Next"" button shows the next slide . Thisbutton is disabled when the current slide is the last one . Clicking on the ""Prev"" button shows the previousslide . Thisbutton is disabled when the current slide is the first one . Clicking on the ""Restart"" button returns to the first slide . This button is disabled when the current slide is the first one . You can assume that the passed slides array contains at least one slide . Initially , the file is filled with boilerplate code . Note the following: The ""Restart"" button must have data-testid=""button-restart"" . The ""Prev"" button must have data-testid=""button-prev"" . The ""Next"" button must have data-testid=""button-next"" . Each slide's title must be rendered as an <h1> element with data-testid=""title"" . Each slide's text must be rendered as a <p> element with data-testid=""text"" . Please note that the component has the above data-testid attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/fora32amot/files/964a28c617ce889a4f5d9c819480dc9a/project.zip
nodejs18_15__reactjs
npm test
[{"file": "junit.xml", "name": "App renders correctly", "type": "junit", "weight": 0.5}, {"file": "junit.xml", "name": "Switching between slides works as expected", "type": "junit", "weight": 0.5}]
['junit.xml']
2
830,922
React: Autocorrection App
fullstack
Create a basic autocorrection application per the requirements below . The finished application must pass all of the unit tests . Hide animation Show animation Complete the implementation of src/components/AutocorrectTextarea . js according to the following requirements: AutocorrectTextareais a component that takes a corrections Object that mapsstrings to their corrections . For example , the object below denotes that 'really'is a correction for 'realy', and 'weird' is a correction of 'wierd': const corrections = { 'realy': 'really', 'wierd': 'weird', }; Assume that no value of the corrections objectappears as the property in the corrections object . AutocorrectTextarearenders a textarea element and lets users write text in it . Assume that the text consists only of words separated by a single space character . Once a space character is typed , the word preceding it is considered to be completeand must be autocorrected according to the corrections object if a correction exists . Initially , the file is filled with boilerplate code . Note the following: The textarea element must have data-testid=""textarea"" . Please note that the component has these data-testid attributes for test cases , and certain classes and ids for rendering purposes . You should not change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/fq3ndjp3cnd/files/c7d85966dadfd55ee3c43e45507ef91e/project.zip
nodejs18_15__reactjs
npm test
[{"file": "junit.xml", "name": "Test without removing characters", "type": "junit", "weight": 0.5}, {"file": "junit.xml", "name": "Test with removing characters", "type": "junit", "weight": 0.5}]
['junit.xml']
2
834,599
Angular: Temperature Converter
fullstack
Create a Temperature Converter component , as shown below: Hide animation Show animation The component should have the following functionalities: It has 2 input number fields . The first is for a Celsius value , and the second is for a Fahrenheit value . Initially , both fields are empty . As a value is typed into the Celsius field , convert it to Fahrenheit and show it in the Fahrenheit field . Use the formula F = C9/5 + 32 for conversion . In case of decimals , show up to 1 decimal value . As a value is typed into the Fahrenheit field , convert it to Celsius and show it in the Celsius field . Use the formula C = (F 32) 5/9 for conversion . In case of decimals , show up to 1 decimal value . The following data-test-id attributes are required in the component for the tests to pass: The Celsius input should have the data-test-id attribute 'celsius-input'. The Fahrenheit input should have the data-test-id attribute 'fahrenheit-input'. Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/7km300bdplr/stack/84dikbenplr/3d9ab3b32ab9d9c75fe8c6db53b92554.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "TemperatureConverter Typing value in Fahrenheit field gets correct Celsius value", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "TemperatureConverter Typing value in Celsius field gets correct Fahrenheit value", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "TemperatureConverter Typing value in Fahrenheit field gets correct Celsius value upto 1 decimal values", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "TemperatureConverter Typing value in Celsius field gets correct Fahrenheit value upto 1 decimal values", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "TemperatureConverter Perform series of actions", "type": "junit", "weight": 0.2}]
['unit.xml']
5
834,944
Angular: Weather Component
fullstack
Create a Weather Details component , as shown below: Hide animation Show animation The component must have the following functionalities: An array of objects is passed as a prop to the component , where each object is a weather record for a single city . The object has 4 properties: name: The name of the city . [STRING] temperature: The temperature in the city . [STRING] wind: The wind in the city . [STRING] humidity: The humidity in the city . [STRING] There is an input field for the city name where the user can type the name of a city to search the weather data for . (The city name is case-insensitive .) If data exists for the typed input , render the weather details <div> as below , inside <div data-test-id=""weather-details""> . <span data-test-id=""output-temperature"">{temperature}</span>, where {temperature} is the value from the weather record . <div data-test-id=""output-wind"">Wind: {wind}</div>, where {wind} is the value from the weather record . <div data-test-id=""output-humidity"">Humidity: {humidity}</div>, where {humidity} is the value from the weather record . If no data exists for the typed input , do not render the weather details <div>, but instead render <div data-test-id=""no-results"">No Results Found</div>. At component render , since nothing is typed , do not render the above two <div> elements (""weather-details"" and ""no-results""). The following data-test-id attributes are required in the component for the tests to pass: The city name input should have the data-test-id attribute 'app-input'. The <div> containing weather details should have the data-test-id attribute 'weather-details'. The <span> containing the temperature should have the data-test-id attribute 'output-temperature'. The <div> containing the wind information should have the data-test-id attribute 'output-wind'. The <div> containing the humidity information should have the data-test-id attribute 'output-humidity'. The 'No Results Found' <div> should have the data-test-id attribute 'no-results'. Please note that components have the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/96t2fag443g/stack/gn1hhmgisgq/3d593c30ccf3ac0dfcc8f56b3742aebe.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "WeatherDetails Perform series of actions", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "WeatherDetails Test with non-existing cities", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "WeatherDetails Initial UI is rendered as expected", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "WeatherDetails Test with existing cities in both upper and small case", "type": "junit", "weight": 0.25}]
['unit.xml']
4
840,893
Angular: Dark Theme Switcher
fullstack
Create a dark theme blogapplication , as shown below . Some core functionalities have already been implemented , but the application is not complete . Application requirements are given below , and the finished application must pass the unit tests . Hide animation Show animation The app has twocomponents: the Blog component and the Theme Switcher component . The list of the blog posts to be displayed is provided . The app should implement the following functionalities: The blog posts should be initially displayed in their respective <article> tags in the same order that they are provided . The Theme Switcher component shouldhave a button titled 'Light Theme' initially . Clicking on the 'Light Theme' button should add the class 'theme--dark' to the body of the page (e . g ., <body class=""theme--dark"">) and should update the button text from 'Light Theme' to 'Dark Theme'. Clicking on the same button again should toggle the theme to Light , and the class 'theme--dark' should be removed from the body of the page . The text of the button should also be updated to 'Light Theme'. Each blog post is an array of objects , and the included markup includes all the necessary details required to render a blog post item . Note: The styling required to change the theme of the app from light to dark is already provided in the project . Adding the class 'theme--dark' will automatically change the related styles throughout the page . The following data-test-id/class attributesare required in the component for the tests to pass . The parent container of theblog post itemsshould have the data-test-id attribute 'blog-posts'. Each blog post itemshould have the data-test-id attribute 'blog-item-0', 'blog-item-1', 'blog-item-2', and so on . Each blog titleparagraph tag <p> should have the data-test-id attribute 'blog-title'. The Theme switcher button should have the data-test-id attribute 'switcher-button'. The span containing thetext inside the Theme switcher button should have the data-test-id attribute 'current-theme'. Please note that the component has these data-test-id attributes for test cases , and certain classes and ids for rendering purposes . You should not change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/5i7bib8bh79/files/f856d9516833f3163e2d75d282ef88ae/project.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "AppComponent Should switch theme correctly on subsequent button clicks", "type": "junit", "weight": 0.3333333333333333}, {"file": "unit.xml", "name": "AppComponent Should render the blog posts and the button on the screen", "type": "junit", "weight": 0.3333333333333333}, {"file": "unit.xml", "name": "AppComponent Clicking on the theme switcher should enable the dark theme", "type": "junit", "weight": 0.3333333333333333}]
['unit.xml']
3
901,370
Angular: Survey List
fullstack
Create a Survey Listapp , as shown below: Hide animation Show animation There are 2 components in the app: Filters component: A reusable component thatis used to define the filters for the final survey list to be rendered . It accepts the filter type and the list of filter values as input , and outputs the selected filter based on the criteria mentioned below . SurveyList component:This component is used to render a list of surveys . The app should have the following functionalities: The app should render the list of Survey objects . The interface for an objectis defined in the file 'src/types/Survey . ts' and has the following structure: interface Survey { title: string; category: string; // Possible values - 'Workplace', 'Development' or 'Hardware' status: string; // // Possible values - 'Active', or 'Completed' label: string; } In the left pane , there are 2 Filters component instances- The first filter instance filters the surveysbased on the'status' property . Clicking on a filter should render the survey objects for which the 'status' value matches the filter value . In case 'All' is clicked , this filter should have no effect and should not filter out any surveys . The second filter instance filters the surveys based on the'category' property . Clicking on a filter should render the survey objects for which the 'category' value matches the filter value . The first click selects a filter and thesecond consecutive click unselects the filter . If both the filters have a value selected , the surveys should be filtered based on the combination of both the filters . For example , if the first filter has Active selected and the second filter has Completed selected , showall ' Active' surveys whose category is ' Completed' in the right pane . The right pane containsthe SurveyList component . It renders the filtered surveyitemsin a list item <li> inside the list <ul data-test-id=""survey-list""></ul>. Initially , all surveys should be rendered in the SurveyList component . The following data-test-id attributes are required in the component for the tests to pass: The <ul> containing 'status' filters: 'status-list'. The <ul> containing 'category' filters: 'category-list'. The output <ul>: 'survey-list'. Please note that the component has the listeddata-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/8b1n75be0pt/stack/1reltlrmrfs/a0ea89b951443e752b9929c1111193c6.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "AppComponent Combination of filters works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "AppComponent Clicking on a category twice render the entire list", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "AppComponent Clicking on \"Hardware\" category filter works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "AppComponent Clicking on \"Workplace\" category filter works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "AppComponent Clicking on \"Development\" category filter works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "AppComponent Clicking on \"Completed\" status filter works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "AppComponent Initial UI is rendered as expected", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "AppComponent Clicking on \"Active\" status filter works", "type": "junit", "weight": 0.125}]
['unit.xml']
8
901,920
Angular: Paginated Football Competitions
fullstack
Create a Football Competitions component , as shown below: Hide animation Show animation The goals are to get a paginated list of football competitions and render their details in a list . The component must have the following functionalities: The component must get competitions by making an API GET call to URL ' https://jsonmock . hackerrank . com/api/footballcompetitions ? page=<pageNumber >' using the Angular HttpClient module . Here , <pageNumber> is the page number to retrieve the data for . The response of the GET call will contain a totalpages field that denotes the number of pages of results available and a data field that is an array of competition records for the requested page . The sample format of the response is: { ""page"": ""1"", ""perpage"": 2, ""total"": 2, ""totalpages"": 1, ""data"": [ { ""name"": ""English Premier League"", ""country"": ""England"", ""year"": 2016, ""winner"": ""Chelsea"", ""runnerup"": ""Tottenham Hotspur"" }, { ""name"": ""La Liga"", ""country"": ""Spain"", ""year"": 2011, ""winner"": ""Real Madrid"", ""runnerup"": ""FC Barcelona"" } ] } On component mount , make a GET call to get the data for page 1 (i . e ., API GET call to URL ' https://jsonmock . hackerrank . com/api/footballcompetitions ? page=1 '. Retrieve totalpages from the response and render pagination buttons corresponding to each pagestarting from 1 to totalpages . Each button must be rendered as <button>{k}</button> , where {k} is the page number the button corresponds to: <button>1</button>, <button>2</button>, and so on until <button>{totalpages}</button>. The buttons must be rendered in the section <section data-test-id=""page-number-buttons""></section> . Clicking on a page button must get records for the corresponding page number and render them . For example , clicking on button 3 must make an API GET call to URL ' https://jsonmock . hackerrank . com/api/footballcompetitions ? page= 3 ', get the data , and render it . For the competitions returned by the API , render the list <ul data-test-id="" football-competitions ""></ul>. This list should have a single <li> list item for each object in the array . The value of each <li> element should be <li> Competition {name} won by {winner} in year{year}</li> where {name}, {winner} and {year} are values retrieved from the corresponding competition object . For example , in the data above , there are 2competition objects in the array . There will be 2 <li> elements inside the <ul> element: <li>Competition English Premier League won by Chelsea in year 2016</li> <li>Competition La Liga won by Real Madrid in year 2011</li> The following data-test-id attributes are required in the component for the tests to pass: The <section> that contains the buttons: 'page-number-buttons' The <ul>: 'football-competitions' Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/8r9f4n9kg2d/stack/5a3fsri2bj3/f7fc62153748128b374181621e4165ea.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "FootballCompetitions Should show correct results when page 3 is clicked", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "FootballCompetitions Should show correct results when page 2 is clicked", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "FootballCompetitions Should render the Initial UI as expected", "type": "junit", "weight": 0.25}, {"file": "unit.xml", "name": "FootballCompetitions Should show correct results when page 4 is clicked", "type": "junit", "weight": 0.25}]
['unit.xml']
4
902,167
Angular: Weather Finder
fullstack
Create a Weather Finder component , as shown below: Hide animation Show animation The component must have the following functionalities: The input should initially be empty . The user can type acity name into this input box to search for weather details for this city . Clicking on the 'Search' button should make an API GET call to the URL ' https://jsonmock . hackerrank . com/api/weather ? name=<name> 'using theAngular HttpClient module . Here , <name> isthe city name entered into the text box . For example , for the value 'Dallas', the API request is https://jsonmock . hackerrank . com/api/weather ? name=Dallas . There will be data for the cities 'Dallas' and 'Oakland'. The responsecontains a data field , where data is an array of objects , and each object is a weather record . Only the first record of the array is rendered in this component . A sample data field for 'Dallas' is below: ""data"": [ { ""name"": ""Dallas"", ""weather"": ""12 degree"", // Format is always ""<value> degree"" ""status"": [ ""Wind: 2Kmph"", // String ""Humidity: 5%"" // String ] } ] The weather details should be rendered inside<div data-test-id=""weather-details""></div> . This div should not be rendered initially since no API has been hit yet . Each weather record containsa weather field . Retrieve the value and display it in the <span data-test-id=""result-temperature""></span> element . If the value in the weather field is less than 20, render the cold weather icon by rendering <i data-test-id=""icon-cold""></i> . If the value is greater than or equal to 20, render the sunny weather icon by rendering <i data-test-id=""icon-sunny""></i> . Each weather record containsa status field which is an array of strings . The first string denotes the wind value and the second string denotes the humidity value . Render the wind value in <div data-test-id=""result-wind""></div>. Render the humidity value in <div data-test-id=""result-humidity""></div>. If no records arereturned for any city , render <div data-test-id=""no-result"">No Results Found</div> instead . This element must be visible onlywhen the data field is an empty array . This div should not be rendered initially since no API has been hit yet . Please note that the input field acceptsonly text . Test cases take will only call the API with valid input , so input validation is not required . For testing purposes , please use the following cities and their corresponding weather conditions: Dallas - Cold Oakland - Sunny The following data-test-id attributes are required in the component for the tests to pass: The input: 'app-input' The 'Search' button: 'submit-button' The weather details: 'weather-details' The sunny icon: 'icon-sunny' The cold icon: 'icon-cold' The span showing temperature: 'result-temperature' The div showing wind information: 'result-wind' The div showing wind information: 'result-humidity' The 'No Results Found' div: 'no-result' Please note that the component has the listed data-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/c7c2qsa4o2g/stack/2ps7pj79ifq/4e257f0aa3b22d50d3def1fbdd7f9c2b.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "WeatherFinder Should show No Results Found when there are no results from API", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "WeatherFinder Should search and render the data - 1", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "WeatherFinder Should search and render the data - 2", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "WeatherFinder Perform series of actions", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "WeatherFinder Should render the Initial UI correctly", "type": "junit", "weight": 0.2}]
['unit.xml']
5
902,629
Angular: Length Converter
fullstack
Create a Length Converter component , as shown below: Hide animation Show animation The component should have the following functionalities: It has 2 input set . Each input set has the following: An input field to type the number which has a label defining unit of measurement selected . A dropdown that has 3 options - Kilometre , Metre , Centimetre . Thearray containing the objects of all possible values in the dropdown is below . Use the 'id' property of each object to pass the value to each option as that is used for testing . [ { id: 0, label: 'Kilometre', unit: 'km' }, { id: 1, label: 'Metre', unit: 'm' }, { id: 2, label: 'Centimetre', unit: 'cm' } ] Initially , both the input fields are empty . The first dropdown should have 'Kilometre' selected on app load and the second dropdown should have 'Metre' selected on app load . Therefore , first input should have the label as 'km' and second inputshould have the label as 'm'. As and when a value is typed in either input field , convert it to unit selected in the other input set and update the value of other input field . Please note , when input fields have values , changing unit from dropdown should update the value of respective input field . Example - first dropdown has Kilometres selected and second dropdown has Metres selected . Any value in typed in first input field should render the converted Metre value in second input field . Use the following conversions: 1 Kilometre = 1000 Metres 1 Metre = 100 Centimetres The following data-test-id attributes are required in the component for the tests to pass: In the first input set - Input fieldhas data-test-id attribute 'app-input1'. Label hasdata-test-id attribute 'app-label1'. Select hasdata-test-id attribute 'app-select1'. In the second input set - Input field has data-test-id attribute 'app-input2'. Label hasdata-test-id attribute 'app-label2'. Select hasdata-test-id attribute 'app-select2'. Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . It is advised not to change them .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/7f4dj57nip5/stack/a8e2675ob1p/d8e3ef3072254eae1ae813307db92ea2.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "LengthConverter Typing value in Metres field gets correct Metres value", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "LengthConverter initial UI is rendered as exptected", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "LengthConverter If input is not empty and dropdown is changed, input field should reflect new value", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "LengthConverter Typing value in Metres field gets correct Centimetres value", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "LengthConverter Typing value in Metres field gets correct Kilometres value", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "LengthConverter Typing value in Kilometres field gets correct Centimetres value", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "LengthConverter Typing value in Kilometres field gets correct Kilometres value", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "LengthConverter Typing value in Kilometres field gets correct Metres value", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "LengthConverter Perform series of operations", "type": "junit", "weight": 0.1111111111111111}]
['unit.xml']
9
906,065
NodeJS: Products Publish API
fullstack
In this challenge , your task is to implement a simple REST API to manage a collection of products . Each product is a JSON entry with the following keys: id : The unique product ID . (Integer) name : The name of the product . (String) price : The selling price of the product .(Float) mrp : The maximum retail price of the product . (Float) stock : The total quantity of the product available . (Integer) isPublished : The boolean value representing if the product is published or not . (Boolean) Here is an example of a product JSON object: { ""id"":1, ""name"": ""Premium Roast Coffee"", ""price"": 1.19, ""mrp"": 1.19, ""stock"": 1, ""isPublished"": false } The model implementation is provided and read-only . The task is to implement the REST service that exposes the /products endpoint , which allows for managing the collection of product records in the following way: POST request to /products : creates a new product expects a JSON product object without the id and isPublished propertyas thebody payload . You can assume that the given object is always valid . a new product should always be created withisPublished property set to false if the payload contains isPublished (either true or false) property , it should be disregarded and always set to false on object creation adds the given product object to the collection of products and assigns a unique integer id to it . The first created product must have id 1, the second one 2, and so on . the response code is 201, and the response body is the created product object GET request to /products : return a collection of all products the response code is 200, and the response body is an array of all product objects ordered by their ids in increasing order PATCH request to /products/<id> : you can assume that the body sent to this patch request will always be{""isPublished"" : true} if the matching product exists , it should validate if the product can be published based on the following criteria in the same order they are mentioned below: CRITERIA 1:check if the mrp property of the matching product is greater than equal to the selling price of the product CRITERIA 2: check if the stock quantity of the product is greater than 0. if anyof the criterias fail , the response code is 422 with the response body containing an array of error messages: if only CRITERIA 1 fails , the response bodyshould be an array containing the message ' MRP should be less than equal to the Price' at the 0thindex . if only CRITERIA 2 fails , the response bodyshould be an array containing the message ' Stock count is 0' at the 0th index . if both CRITERIA 1 and CRITERIA 2 fail , the response body should be an array containing the messages ' MRP should be less than equal to the Price' at the 0th index , and the message ' Stock count is 0' at the 1stindex . if all the criterias pass , the matching product's isPublished field is be set to true and the response code is 204 with no response body . you can assume that the ID passed to the request will always be valid DELETE , PUT request to /products/<id> : the response code is 405 because the API does not allow deletingor modifying products for any id value You should complete the given project so that it passes all the test cases when running the provided unit tests . The project by default supports the use of the SQLite3 database . Example requests and responses POST request to /products Request body: { ""name"": ""Hash Browns"", ""price"": 1.19, ""mrp"": 1.19, ""stock"": 0, ""isPublished"": true } The response code is 201, and when converted to JSON , the response body is: { ""id"": 1, ""name"": ""Hash Browns"", ""price"": 1.19, ""mrp"": 1.19, ""stock"": 0, ""isPublished"": false } This adds a new object to the collection with the given properties and id 1. GET request to /products The response code is 200, and when converted to JSON , the response body (assuming that the below objects are all objects in the collection) is as follows: [ { ""id"": 1, ""name"": ""Hash Browns"", ""price"": 1.19, ""mrp"": 1.19, ""stock"": 0, ""isPublished"": false }, { ""id"": 2, ""name"": ""Egg Meal"", ""price"": 5.29, ""mrp"": 4.29, ""stock"": 1, ""isPublished"": false } ] PATCH request to /products/1 Request body: { ""isPublished"" : true} Product Object: { ""name"": ""Hash Browns"", ""price"": 1.19, ""mrp"": 1.19, ""stock"": 0, ""isPublished"": false } The response code is 422, as only the check for stock quantity fails . Response body: [""Stock count is 0""] PATCH request to /products/1 Request body: { ""isPublished"" : true} Product Object: { ""name"": ""Hash Browns"", ""price"": 2.19, ""mrp"": 1.19, ""stock"": 1, ""isPublished"": false } The response code is 422, as the MRP is less than the price . Response body: [""MRP should be less than equal to the Price""] PATCH request to /products/1 Request body: { ""isPublished"" : true} Product Object: { ""name"": ""Hash Browns"", ""price"": 2.19, ""mrp"": 1.19, ""stock"": 0, ""isPublished"": false } The response code is 422, as both the MRP is less than the price and the stock quantity is 0. Response body: [""MRP should be less than equal to the Price"", ""Stock count is 0""] PATCH request to /products/1 Request body: { ""isPublished"" : true} Product Object: { ""name"": ""Hash Browns"", ""price"": 1.19, ""mrp"": 1.19, ""stock"": 1, ""isPublished"": false } The response code is 204, as all the checks pass . There is no requirement for the response body . DELETE request to /products/1 The response code is 405 and there are no particular requirements for the response body . PUT request to /products/1 The response code is 405 and there are no particular requirements for the response body .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/1almq2qhn04/files/54bf75919fed7634fd81e594ef91d978/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "products_api_medium should create a new product", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should create a new products without the published field", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should fetch all the products", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should fetch no products if there are not products stored", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should publish the product if all the constraints are met", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should publish the product and the data should be updated in the DB", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should get 422 when MRP is less the price of the product", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should get 422 when stock of the product is 0", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should get 422 when both MRP is less the price of the product and stock of the product is 0", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should get 405 for a put request to /products/:id", "type": "junit", "weight": 0.09090909090909093}, {"file": "unit.xml", "name": "products_api_medium should get 405 for a delete request to /products/:id", "type": "junit", "weight": 0.09090909090909093}]
['unit.xml']
11
906,396
NodeJS: Analytics Ingestion API
fullstack
In this challenge , your task is to implement a simple REST API to manage a collection of the high-volume event streams . Each event is a JSON entry with the following keys: id : The unique entry ID . (Integer) eventType : The type of event data entry . Can be one of 'click' or 'pageView'. (String) user : The unique user ID .(Integer) date : The date when the event occurred(Date) Here is an example of an event JSON object: { ""id"": 1, ""eventType"": ""click"", ""user"": 1, ""date"": ""2020-08-29T08:48:48.737Z"" } The model implementation is provided and read-only . The task is to implement the REST service that exposes the /analytics endpoint , which allows for ingesting and querying the collection of event records in the following way: POST request to /analytics : creates a set of events serially expects a JSON array containing a series of user eventswithout the id and the date properties as thebody payload . Each object in the JSON array must be validated before saving based on the below-mentioned criteria . each list of the events can contain duplicate entries for auser and the event type . Every event objectin the listshould fulfilthe following criteriain order to be saved into the systemto avoid duplicates: a user can have only one 'click' event type in a 3-second window . All other 'click' events for the same user in the window should be discarded . a user can have only one 'pageView' event type in a 5-secondwindow . All other 'pageView' events for the same user in the window should be discarded . adds the given event object to the collection of events and assigns a unique integer id to it . The first created event must have id as 1, the second one has id as 2, and so on . adds the date property equal to the current system date to each saved object . the response code is 201, and the response body is a JSON containing the total number of events that were successfully ingested . Sample is : {""ingested"" : 4} HINT: In order to find an event in a n-second window from current time T , you can use the [Op . gte] operator of sequelize with the value set to the (T-n) seconds . { date: { [Op . gte] : VALUE} } //Where value is T - n seconds NOTE: A utility function subtractSecondsFromCurrentTime is provided in the utils . js file which accepts the seconds to subtract from the current time and returns the javascript date object for the time (T-n) GET request to /analytics : return a collection of all events the response code is 200, and the response body is an array of all events in any sort order DELETE , PUT , PATCH request to /analytics/<id> : the response code is 405 because the API does not allow deletingor modifying events for any id value You should complete the given project so that it passes all the test cases when running the provided unit tests . The project by default supports the use of the SQLite3 database . Example requests and responses POST request to /analytics Request body: [ { ""user"": 1, ""eventType"": ""click"" }, { ""user"": 2, ""eventType"": ""click"" }, { ""user"": 1, ""eventType"": ""pageView"" } ] Notice that all the 3 entries in this event set have unique eventType-user mapping initially and there are no events in the system yet . Thus , all 3 can be saved . The response code is 201, and when converted to JSON , the response body is: {""ingested"" : 3} This adds 3 new objects to the collection with the given properties and id 1,2,3 respectively and appropriate date values (set to the current system date). POST request to /analytics Request body: [ { ""user"": 1, ""eventType"": ""click"" }, { ""user"": 2, ""eventType"": ""pageView"" }, { ""user"": 1, ""eventType"": ""pageView"" } ] Before 3 seconds have passed after the first request: Each object can be evaluated as follows: 1. user: 1, eventType: click - An entry already exists for this combo in the system in the last 3 seconds . This can be discarded . 2. user: 2, eventType: pageView - No entries can be found for this combo saved in the last 5 seconds . This can be saved . 3. user: 1, eventType: pageView - An entry already exists for this combo saved in the last 3 seconds . This can be discarded . Only one object in this set matches the criteria and can be saved . The response code is 201 with the response body as: {""ingested"" : 1} After 3 seconds have passed after the first request: Each object can be evaluated as follows: 1. user: 1, eventType: click - No entries can be found for this combo saved in the last 3 seconds . This can be saved . 2. user: 2, eventType: pageView - No entries can be found for this combo saved in the last 5 seconds . This can be saved . 3. user: 1, eventType: pageView - No entries can be found for this combo saved in the last 3 seconds . This can be saved . After 3 seconds have elapsed since the first request , all the objects in this set match the criteria and can be saved . The response code is 201 with the body: Response body: {""ingested"" : 3} GET request to /analytics The response code is 200, and when converted to JSON , the response body (assuming that the below objects are all objects in the collection) is as follows: [ { ""id"": 1, ""eventType"": ""click"", ""user"": 1, ""date"": ""2020-08-29T09:46:12.638Z"" }, { ""id"": 2, ""eventType"": ""click"", ""user"": 2, ""date"": ""2020-08-29T09:46:12.644Z"" }, { ""id"": 3, ""eventType"": ""pageView"", ""user"": 1, ""date"": ""2020-08-29T09:46:12.647Z"" } ] DELETE request to /analytics/1 The response code is 405 and there are no particular requirements for the response body . PUT request to /analytics/1 The response code is 405 and there are no particular requirements for the response body . PATCH request to /analytics/1 The response code is 405 and there are no particular requirements for the response body .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/5g6ct491pc8/files/e464ee680940efbd54b340dff9d9a5d8/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "analytics_api_medium should ingest all the data correctly", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "analytics_api_medium should avoid duplicated and return all the ingested events correctly", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "analytics_api_medium should ingest click events only once per user every 3 seconds", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "analytics_api_medium should ingest pageView events only once per user every 5 seconds", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "analytics_api_medium should return the ingested events count correctly after few iterations", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "analytics_api_medium should get 405 for a put request to /analytics/:id", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "analytics_api_medium should get 405 for a delete request to /analytics/:id", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "analytics_api_medium should get 405 for a patch request to /products/:id", "type": "junit", "weight": 0.125}]
['unit.xml']
8
906,829
Angular: User Lists
fullstack
Create a User Lists app as shown below: Hide animation Show animation There are 2 components in the app: DataForm component: This component is used to add a new item of either the Song or Book type to the list . DataList component: A reusable component that is used to render the list of Songs and the list of Books . Accepts the appropriate List and the dataType (One of ""Song"" or ""Book"") as input . The app should have the following functionalities: Initially , all fields should be empty . The user can add items to the book list or the song list from the same form . Adding an item in the form at the top should add it to the respective list below . There are 3 required text input fields:'name', 'genre', and 'creator'. There is also a 'type' input field with 2 options to specify whetherthe item being added isa book or a song . Assume that each item is uniquely identified by its name . Tests will use unique names only . On choosing 'Song', render an extra input field 'totalTime'. Clicking on the 'Add' button should add the item to the respective list and clear all the input fields . A Book item should be added to <tabledata-test-id=""book-table""> as a <tr> . A Song itemshould be added to <tabledata-test-id=""song-table""> as a <tr> . The DataList component renders the book list and song list in a table with columnsname , genre , creator of each item followed by a delete button . Clicking on the delete button should delete the respective item from the list . The song list has an extra column ,'Time', to render 'Total Time' information for the item . The interface for an item is defined in the file 'src/types/Item . ts' with the following structure: interface Item { name: string; genre: string; creator: string; type: string; totalTime ?: number; } The following data-test-id attributes are required in the component for the tests to pass: The input field for 'name': 'app-input-name' The input field for 'genre': 'app-input-genre' The input field for 'creator': 'app-input-creator' The input field for 'total time': 'app-input-time' The input field for type Book: 'app-input-book-type' The input field for type Song: 'app-input-song-type' The 'Add' button: 'add-button' The book table: 'book-table' The song table: 'song-table' Rows in a single tablehave a data-test-id attribute 'list-item-0', 'list-item-1' and so on . Any name cell:'item-name' Any creatorcell: 'item-creator' Any total time cell: 'item-time' Any cell with a delete button: 'item-delete' Please note that the component has the data-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/gecen8th0sh/stack/7pofpsc8fbr/e396faee64de058314ca7c56355eaebb.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "AppComponent Clicking on type Song and Add button should clear the input fields", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "AppComponent Perform a series of operations including delete", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "AppComponent Clicking on type Book and Add button should add the item to the Book list", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "AppComponent Initial UI is rendered as expected", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "AppComponent Clicking on Song type should render time input", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "AppComponent Clicking on type Song and Add button should add the item to the Song list", "type": "junit", "weight": 0.16666666666666666}]
['unit.xml']
6
907,010
Angular: Product Comparison
fullstack
Create a Product Comparison component as shown below: Hide animation Show animation The component should have following functionalities: The product information is passed to the component as props . An exampleproduct object is: { laptopName: ""Dell 14 3000 Core i3 7th Gen"", laptopImage: ""/assets/images/image1. jpeg"", laptopBrand: ""Dell"", id: 1, features: { processorBrand: ""Intel"", ram: ""4GB"", numberOfCores: ""2"" } } There are 2 dropdownsto select 2 products . The values of each option in a dropdown should be an id of a product . Initially , neither dropdown has a value selected . When no values are selected , show the message 'Please select products' in the messagediv , <divdata-test-id=""app-message""></div>. If only one dropdown has a value selected , show the message 'Select 2 products for comparison' in the message div , <divdata-test-id=""app-message""></div>. If both dropdowns have the same value selected , show the message 'Both products are identical' in the message div , <divdata-test-id=""app-message""></div>. If both dropdowns have different values selected , retrieve the product information with by id from the products list prop . Render the information for the first dropdown product in <divdata-test-id=""product1-details""></div>. Render the information for the second dropdown productin <divdata-test-id=""product2-details""></div> . The component should always display either the message div or the product details divs , but not both . The product information should be mapped in the order below inside its details div: the src of the <img> should contain the laptopImage property laptopName should be rendered as <p data-test-id=""name"">Laptop: {laptopName}</p> laptopBrand should be rendered as <p data-test-id=""brand"">Brand: {laptopBrand}</p> processorBrand should be rendered as <p data-test-id=""processor"">Processor Brand: {processorBrand}</p> ram should be rendered as <p data-test-id=""ram"">RAM: {ram}</p> numberOfCores should be rendered as <p data-test-id=""cores"">Number of Cores: {numberOfCores}</p> The following data-test-id attributes are required in the component for the tests to pass: The first dropdown: 'app-select1' The div showing the first product details: 'product1-details' The second dropdown: 'app-select2' The div showing the second product details: 'product2-details' The div showing message : 'app-message' For each product details div: The <p> tag containinglaptopName: 'name' The <p> tag containinglaptopBrand: 'brand' The <p> tag containingprocessorBrand: 'processor' The <p> tag containingram: 'ram' The <p> tag containingnumberOfCores: 'cores' Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/8agg15hep7q/stack/3e6snr1s57q/8cf5c8447c618a8bca04749c51c5dc70.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "ProductComparison Should render correct message when only 1 product selected", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "ProductComparison Should render the Initial UI correctly", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "ProductComparison Perform series of operations", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "ProductComparison Should render correct product details when both are non-identical", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "ProductComparison Should render correct message when only both products are identical", "type": "junit", "weight": 0.2}]
['unit.xml']
5
907,822
Angular: Blog Posts
fullstack
Create a Blog Posts module as shown below: Hide animation Show animation The module should have the following functionalities: The module should have 3routes - Nav item 'Create Post' should navigate tohome route '/' which loads CreatePost component . Nav item 'Draft Posts' should navigate to the route '/drafts' which loads DraftPosts component . Nav item 'Published Posts' should navigate to the route '/published' which loads PublishedPosts component . The app has a service namedApp Service which can be used to store the list of Draft and Published Posts globally . The interface for a Post has been defined in this file having the following structure: interface Post{ title: string; description: string; } In the CreatePost component - There is a title input and a description text area . Both are initially empty . The user can enter the values in both , and click on either the'Save as draft' or 'Publish' button . Clicking 'Save as draft' should save the post in the draft post listin the app service . Clicking 'Publish' should save the post in the published post list in the app service . When either button is clicked , reset both the input and text area values . In DraftPosts component - Render all the poststhat are saved in the draft post list in the app serviceinside <divdata-test-id=""draft-posts"">. Each post is rendered as a <div> containing 2 children: Title is rendered inside <h4 data-test-id=""title"">{title}</h4>. Description is rendered inside <div data-test-id=""description"">{description}</div>. In PublishedPosts component - Render all the poststhat are saved in the published post list in the app serviceinside <divdata-test-id=""published-posts"">. Each post is rendered as a <div> containing 2 children: Title is rendered inside <h4 data-test-id=""title"">{title}</h4>. Description is rendered inside <div data-test-id=""description"">{description}</div>. The following data-test-id attributes are required in the component for the tests to pass: title input: 'app-input-title' description text area:'app-input-description' 'Save as draft'button: 'save-draft-button' 'Publish'button: 'publish-button' div containing draft posts: 'draft-posts' div containing published posts: 'published-posts' For every post rendered: The <h4> containing title: 'title'. The <h4> containing description: 'description'. Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/4dkt4f71dmn/stack/a8t9enq972n/272a5b3e2472bfa4ad16bc3676174ee9.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "AppComponent Perform series of actions", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Published drafts reflect on clicking of Published Posts nav and route is correct", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Saved drafts reflect on clicking of Draft Posts nav and route is correct", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Input is cleared when save draft button is clicked", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Input is cleared when publish button is clicked", "type": "junit", "weight": 0.2}]
['unit.xml']
5
907,914
NodeJS: Medical Records Module
fullstack
As a NodeJS developer in your company , you have been given the responsibility to create a medical records manager module that fetches the records from an external API and uses these records to provide insights within the time limits specified . Implement the module records . js such that it has the following set of functionalities: The file should export a class MedicalRecords as the default export of the module , and it should inherit from the EventEmitter class . The class should have the following methods: constructor : Fetches the records from an API and getsthe list of paginated medical records . TheURL is ' https://jsonmock . hackerrank . com/api/medicalrecords ? page=[PAGE]' where PAGE is the numeric page number to fetch the paginated data from the API . When all the records are fetched from the API for all the pages , the class should emit the 'INITIALISED' event with no data requirements for the payload to be passed to the callback . The date from the API contains a list of medical records which are then used to provide insights . The responsehas the following format: { page: 1, perpage: 10, total: 1, totalpages: 1, data: [ // Data contains the list of medical records { id: 11, timestamp: 1563846626267, diagnosis: { id: 2, name: ""Common Cold"", severity: 1 }, vitals: { bloodPressureDiastole: 126, bloodPressureSystole: 75, pulse: 99, breathingRate: 22, bodyTemperature: 101.9 }, doctor: { id: 2, name: ""Dr Arnold Bullock"" }, userId: 3, userName: ""Helena Fernandez"", userDob: ""23-12-1987"", meta: { height: 157, weight: 108 } ... }, ] } page : The current page number of the response (Number) perpage : The total number of items in a single page . This property is immutable . (Number) total : The total number of medicalrecords matching the filter criteria (Number) totalpages : The total number of pages containing the results for the filter criteria(Number) data : The Array containing a list of records (Array of objects) getAveragePulseForUser : Accepts a numeric userId as an argument and returns the average pulse for the user as a float value synchronously . From the fetched records , use matching userId property to get the records for a particular user and useproperty 'vitals . pulse' for each record to calculate the avergae . getDiagnosedDiseaseNamesForDoctor : Accepts a numeric doctor ID as an argument and returns the unique disease names , synchronously , diagnosed by the doctor as a string separated by ',' in the order , they appear in the records . Use matching doctor . id to get the records for a particular doctor and use property 'diagnosis . name' property to calculate unique diseases . The file index . js is present with an example implementation of this class and can be used to validate if the class works as expected . The Example output of this file is mentioned below . Pages of the paginated APIs can be accessed by modifying the page value in the request . Eg: https://jsonmock . hackerrank . com/api/medicalrecords ? page=2 to fetch record for page number 2. You should complete the given project so that it passes all the test cases when running the provided unit tests . You are free to use any package make API requests . For convenience , the project already includes the axios package to make API calls . Test Requirements The records . js file should export the class MedicalRecords as the default export of the module . Make sure that the args passed to the getAveragePulseForUser and getDiagnosedDiseaseNamesForDoctor methods are Number only , between 1 to 4. The maximum time allotted to run each test is 5000ms . Example Implementation const MedicalRecords = require('./records'); const recordsManager = new MedicalRecords(); recordsManager . on('INITIALISED', () => { const averagePulse = recordsManager . getAveragePulseForUser(2) console . log(Average pulse is {averagePulse} for user (ID: {2})) const diseaseNames = recordsManager . getDiagnosedDiseaseNamesForDoctor(4) console . log(Diagnosed disease names of doctor ID: {4} , diseaseNames) })
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/aiir5okfhd4/files/bf379e7880e0519390565544bb29b922/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "rest_api_external_medical_records \"before each\" hook for \"should initialise the records on init\"", "type": "junit", "weight": 1.0}]
['unit.xml']
1
907,928
Angular: Form Validation
fullstack
Create a Form Validation component as shown below: Hide animation Show animation The component should perform the following validations in the form: The name input field should pass following validations . In case of error , the appropriate message should be shown in <div data-test-id=""name-input-error""></div>. The field is required . For this error show the message 'Name is required'. The minimum length is 2. For this error show the message 'Name should contain a minimum of 2 characters'. The name cannotcontain the substring 'Bob' (case insensitive). For this error show the message 'Name cannot contain Bob'. The email input field should pass following validations . In case of error , the appropriate message should be shown in <divdata-test-id=""email-input-error""></div>. The field is required . For this error show the message 'Email is required'. The emaildomain cannot be 'example . com'. For this error show the message 'Email domain cannot contain example . com'. A valid email address should have the following rules: It should start with a letter and can contain combinations of letters , digits , and dots until it reaches the symbol @. It can have 2to 10 characters before the symbol @. After the symbol @, it should contain 2to 10 alphabetic characters before encountering the dot symbol (.). After the (.) dot symbol , it should contain 2to 10 alphabetic characters . Eg: john . doe3@gmail . com is a valid email address . For this error , show the message 'Email has invalid pattern'. Validations should trigger when the input is touched for the first time . Initially , the submit button should be disabled . When eitherfield is invalid , the submit button should be disabled . When both fields are valid and have been touched , the submit button should be enabled . The following data-test-id attributes are required in the component for the tests to pass: The name input: 'name-input' The email input: 'email-input' The submit button: 'submit-button' The div containing the error message for: the name input: 'name-input-error' the email input: 'email-input-error' Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/f37rmckkhdk/stack/7bhmsbl1knk/1e82ad739332765ac1bdb372f62f844a.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "FormValidation Validation email example.com is forbidden works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "FormValidation Button should be enabled when both inputs are correct and no errors should be shown", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "FormValidation Validation email required works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "FormValidation Validation name required works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "FormValidation initial UI is rendered as exptected", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "FormValidation Validation name Bob is forbidden works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "FormValidation Validation email pattern works for failure cases", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "FormValidation Validation name min length works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "FormValidation Validation email pattern works for success cases", "type": "junit", "weight": 0.1111111111111111}]
['unit.xml']
9
907,933
ExpressJS: Authorization Middleware
fullstack
Your company is launching a task manager app soon . The team has already created an ExpressJS app with several routes for creating and managing tasks . As the NodeJS developer in your company , you are required to write an Authorization middleware to provide access to some routes based on the role of the user . The middleware should implement the following functionalities: Complete the middleware . js module . The module's default export is an Express JS middleware function . This function should parse the 'x-role' header and check whether the role has access to the route or not . The scope of the route is passed to the middleware as a string in the format <SCOPENAME>.<ACTIONNAME> Example: To check if the user has access to the create a task (in the tasks route), the scope passed to the middleware will be ""tasks . create"", where ""tasks"" is the scope name and ""create"" is the action name separated by a ""."" dot . The roles-scopes mapping is stored in a file named roles . txt. The data is stored as a JSON string . The structure of each role-scope mapping object is as follows: { ""role"": ""admin"", ""scopes"": { ""tasks"": [ ""create"", ""getById"" ] } } role: This is the property which has to match with the x-role header value passed with the request . [STRING] scopes: An object containing key-value pairs corresponding to each SCOPENAME of the system . If the passed scope name does not match with any of the keys defined in the object , the access is invalid and the server should respondback with the status code 403 while not passing the control to the next function . [OBJECT] [scopeName]: Each dynamic key in the scopes object is a list of valid actions the user has access to in the current scope . [STRING ARRAY] If the role passed in the x-role header is not present in the roles JSON , it does not have access and the server should respondback with the status code 403 while not passing the control to the next function . If the role has access to the route , pass the control to the next function in the middleware stack . Complete the tasks . js module to include all the routes with the appropriate middleware mapping mentioned below . HINT: Make sure to trim the extra whitespaces from the JSON string before parsing it . Test Requirements The middleware functionshould be written in the file middleware . js , and the function should be the default export of the file . The function must call the next() function once authorization is successful . Routes Route Method Scope Admin Customer /tasks GET NA Allowed Allowed /tasks POST tasks . create Allowed Not Allowed /tasks/:id GET tasks . getById Allowed Allowed / GET NA Allowed Allowed
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/eskmfitrbh3/files/3da10d3aef536f8dd2541bfe72aa5111/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "express_authorization_middleware Should send a 403 if the x-role header is not present", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_authorization_middleware Should send a 200 for a non-protected route", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_authorization_middleware Should send a 403 if the x-role value is invalid", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_authorization_middleware Should send a 403 if the x-role value does not have access to route", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_authorization_middleware Should send a 201 if the x-role value has access to route", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_authorization_middleware Should validate header for protected routes", "type": "junit", "weight": 0.14285714285714285}, {"file": "unit.xml", "name": "express_authorization_middleware Should not require auth headers for unprotected routes", "type": "junit", "weight": 0.14285714285714285}]
['unit.xml']
7
908,482
Angular: Document Validation
fullstack
Create a Document Validation component as shown below: Hide animation Show animation The component should perform the following validations for a document form: The title input field should pass the following validations . In case of error , the appropriate message should be shown in <div data-test-id=""title-input-error""></div> . The field is required . For this error show the message 'Title is required'. The size input field should pass following validations . In case of error , the appropriate message should be shown in <divdata-test-id=""size-input-error""></div>. The field is required . For this error show the message 'Size is required'. Size should be greater than 0. For this error show the message 'Size should be greater than 0'. Size should be less than 500. For this error show the message 'Size should be less than 500'. The format input field should pass following validations . In case of error , the appropriate message should be shown in <divdata-test-id=""format-input-error""></div>. The field is optional . No error is triggered if there is no value . If a value is entered , the format value should be one of the following: 'txt', 'pdf', or 'docx'. For this error show the message 'Format should either be txt , pdf or docx'. The password input field should pass following validations . In case of error , the appropriate message should be shown in <divdata-test-id=""password -input-error""></div>. The field is required . For this error show the message 'Password is required'. A valid password is at least 6characterslongand should contain at least 1 uppercase , 1 lowercase , and 1 numeric character . For this error show the message 'Password has invalid pattern'. When fields are invalid , the submit button should be disabled . Hence , initially , the button is disabled . When all fields are valid and touched , the submit button should be enabled . The following data-test-id attributes are required in the component for the tests to pass: The title input:'title-input' The size input:'size-input' The format input:'format-input' The password input:'password-input' The submit button:'submit-button' The container having the error message for : the title input field:'title-input-error' the size input field:'size-input-error' the format input field:'format-input-error' the password input field:'password-input-error' Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/96dpjth2cbr/stack/2nr8rbbc18h/a6ef48f793f30c3b8583b5e12ba17e4d.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "DocumentValidation Validation password pattern works - 3", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation password pattern works - 4", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation format content validation works", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Button shoule be enabled when all inputs are correct and no errors should be shown", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation password pattern works - 2", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation size less than 500 works", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation format content optional validation works", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation password required works", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation password pattern works - 1", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation initial UI is rendered as expected", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation title required works", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation size required works", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "DocumentValidation Validation size greater than 0 works", "type": "junit", "weight": 0.07692307692307693}]
['unit.xml']
13
908,528
Angular: Task Tracker
fullstack
Create a Task Tracker module as shown below: Hide animation Show animation The module should have the following functionalities: The module should have 4 routes - Nav item 'Create Task' should navigate to the home route'/' which loads the CreateTask component . Nav item 'Active' should navigate to theroute '/active' which loads the ActiveTasks component . Nav item 'Completed' should navigate to theroute '/completed' which loads the CompletedTasks component . Nav item 'Others' shouldnavigate to theroute '/others' which loads the OtherTasks component . The app has a service namedApp Service which is used to store the list of tasks in memory globally . The interface for a Task has been defined in this file having the following structure: interface Task { name: string; status: string; } In the CreateTask component - There are 2 inputs - task name and task status . Both are initially empty . The user can enter the values in both . Clicking on the 'Submit' button should add the task to the task listin the app service reset the input values In the ActiveTasks component - Renders the tasks that have a status of 'active' in the task list in the app service . (case insensitive) All active tasks should be rendered as alist item in the list <uldata-test-id=""active-tasks""> where each list item contains task name <li>{taskName}</li> . In the CompletedTasks component - Render all the tasks that have a status of 'completed' in the task list in the app service . (case insensitive) All completed tasks should be rendered as alist item in the list <uldata-test-id=""completed -tasks""> where each list item contains task name <li>{taskName}</li> . In the OtherTasks component - Render the tasks that have a status other than 'active' or'completed' in the task list in the app service . (case insensitive) These tasks should each be rendered as alist item in the list <uldata-test-id=""other -tasks""> where each list item contains task name <li>{taskName}</li> . The following data-test-id attributes are required in the component for the tests to pass: The task name: 'app-input-name' The task status input: 'app-input-status' The submit button: 'submit-button' The active tasks list: 'active-tasks' The completed tasks list: 'completed-tasks' The other tasks list: 'other-tasks' Please note that the component has the above data-test-id attributes for test cases and certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/gbq8gghfgm6/stack/ebcg3d51efg/33f52e0a64e06b197e4acdfeec6707af.zip
angularjs_vm
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "AppComponent Perform series of actions", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Other tasks reflect on clicking on Others nav and route is correct", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Completed tasks reflect on clicking on Completed nav and route is correct", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Active tasks reflect on clicking on Active nav and route is correct", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Input is cleared when submit button is clicked", "type": "junit", "weight": 0.2}]
['unit.xml']
5
908,739
NodeJS: Reminders API
fullstack
In this challenge , your task is to implement a simple REST API to manage a collection of reminders . Each product is a JSON entry with the following keys: id : The unique reminder ID . (Integer) user : The unique user ID . (Integer) description : The description of the reminder(String) date : The date of the reminder . Stored in UTC .(String) Here is an example of a reminder JSON object: { ""id"": 2, ""user"": 1, ""description"": ""Drink Coffee"", ""date"": ""2020-08-24T07:28:24.000Z"" } The model implementation is provided and read-only . The task is to implement the REST service that exposes the /reminders endpoint , which allows for managing the collection of reminder records in the following way: POST request to /reminders : creates a new reminder expects a JSON reminder object without the id propertyas thebody payload . You can assume that the given object is always valid . adds the given reminderobject to the collection of reminders and assigns a unique integer id to it . The first created reminder must have id 1, the second one 2, and so on . the response code is 201, and the response body is the created reminder object GET request to /reminders : return a collection of all reminders the response code is 200, and the response body is an array of all reminders objects ordered by their ids in increasing order optionally accepts query parameters user and after , for example /reminders ? user=1&after=1598448504000 . All these parameters are optional . In case they are present , only objects matching the parameters must be returned . The query param after accepts the time in milliseconds(Epoch) and can be used to find all the reminders that have the date property value after the queried time . HINT: Query for date in Sequelize can be done using the Op . gte operator . It accepts the date as an epoch integer , JS Date object or ISODate String . { date: { [Op . gte] : VALUE} } //Where VALUE can be one of the above mentioned types GET request to /reminders/<id> : returns a reminder with the given id if the matching reminder exists , the response code is 200 and the response body is the matching reminder object if there is no reminder with the given id in the collection , the response code is 404with the response body having the text ID not found. DELETE , PUT , PATCH request to /reminders/<id> : the response code is 405 because the API does not allow deletingor modifying reminders for any id value You should complete the given project so that it passes all the test cases when running the provided unit tests . The project by default supports the use of the SQLite3 database . Example requests and responses POST request to / reminders Request body: { ""user"": 1, ""description"": ""Eat Lunch"", ""date"": ""2020-08-24T13:28:24.000Z"" } The response code is 201, and when converted to JSON , the response body is: { ""id"": 1, ""user"": 1, ""description"": ""Eat Lunch"", ""date"": ""2020-08-24T13:28:24.000Z"" } This adds a new object to the collection with the given properties and id 1. GET request to /reminders The response code is 200, and when converted to JSON , the response body (assuming that the below objects are all objects in the collection) is as follows: [ { ""id"": 1, ""description"": ""Eat Lunch"", ""date"": ""2020-08-24T13:28:24.000Z"", ""user"": 1 }, { ""id"": 2, ""description"": ""Eat Breakfast"", ""date"": ""2020-08-25T08:28:24.000Z"", ""user"": 2 } ] GET request to /reminders ? after=1598341224000 The response code is 200, and when converted to JSON , the response body (assuming that the below objects are all objects matching the filter) is as follows: [ { ""id"": 2, ""description"": ""Eat Breakfast"", ""date"": ""2020-08-25T08:28:24.000Z"", ""user"": 2 } ] GET request to /reminders ? user=2 The response code is 200, and when converted to JSON , the response body (assuming that the below objects are all objects matching the filter) is as follows: [ { ""id"": 2, ""description"": ""Eat Breakfast"", ""date"": ""2020-08-25T08:28:24.000Z"", ""user"": 2 } ] GET request to /reminders/2 The response code is 200, and when converted to JSON , the response body (assuming that the object with id as 2 exists) is as follows: { ""id"": 2, ""description"": ""Eat Breakfast"", ""date"": ""2020-08-25T08:28:24.000Z"", ""user"": 2 } If an object with id 2 doesn't exist , then the response code is 404 with the response body having the text ID not found. DELETE request to /reminders/1 The response code is 405 and there are no particular requirements for the response body . PUT request to /reminders/1 The response code is 405 and there are no particular requirements for the response body . PATCH request to /reminders/1 The response code is 405 and there are no particular requirements for the response body .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/660pj3ge1rg/files/403bbeb5c951d69420e7870bd052cf2f/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "reminders_api should create a new reminder", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should fetch all the reminders", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should fetch no reminders if no matching results are present for user", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should fetch no reminders if no matching results are present after the date", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should fetch all the reminders for a user", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should fetch all the reminders after the date", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should fetch all the reminders for a user after the date", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should fetch a single reminder", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should get 404 if the reminder ID does not exist", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should get 405 for a put request to /reminders/:id", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should get 405 for a patch request to /reminders/:id", "type": "junit", "weight": 0.08333333333333333}, {"file": "unit.xml", "name": "reminders_api should get 405 for a delete request to /reminders/:id", "type": "junit", "weight": 0.08333333333333333}]
['unit.xml']
12
909,060
NodeJS: Blog Posts API
fullstack
In this challenge , your task is to implement a simple REST API to manage a collection of blog posts . Each post is a JSON entry with the following keys: id : The unique post ID . (Integer) author : The unique user ID . (Integer) title : The title of the Blog Post (String) isPublished : The boolean field denoting if the post is published (Boolean) timestamp : The date when the blog post is created . Stored as Epoch Time in Milliseconds(Number) publishedDate : The date when the blog post is published . Stored as Epoch Time in Milliseconds(Number) Here is an example of a post JSON object: { ""isPublished"": true , ""title"": ""Overcoming Bias in Recruiting to Create a Culture of Diversity & Inclusion"", ""author"": 1, ""timestamp"": 1531522701000, ""publishedDate"": 1598775265079, ""id"": 1 } The model implementation is provided and read-only . The task is to implement the REST service that exposes the /posts endpoint , which allows for managing the collection of blog posts in the following way: POST request to /posts : creates a new blog post expects a JSON blog post object without the id and without the publishedDate propertiesas thebody payload . You can assume that the given object is always valid . adds the given post object to the collection of blog posts and assigns a unique integer id to it . The first created post must have id 1, the second one 2, and so on . if the isPublished property for a post payload object is true , sets the publishedDate to current system time in milliseconds before saving . the response code is 201, and the response body is the created post object GET request to /posts : return a collection of all posts the response code is 200, and the response body is an array of all post objects ordered by their ids in increasing order optionally accepts query parameters author and isPublished , for example /posts ? author=1&isPublished=true . All these parameters are optional . In case they are present , only objects matching the parameters must be returned . only the values true or false are valid for the isPublished query param . If any other value is passed in the request , it should be discarded and isPublished property must not be queried upon as the data type is Boolean . GET request to /posts/<id> : returns a post with the given id if the matching post exists , the response code is 200 and the response body is the matching post object if there is no post with the given id in the collection , the response code is 404with the response body having the text ID not found. DELETE , PUT , PATCH request to /posts/<id> : the response code is 405 because the API does not allow deletingor modifying posts for any id value You should complete the given project so that it passes all the test cases when running the provided unit tests . The project by default supports the use of the SQLite3 database . Example requests and responses POST request to / posts Request body: When post is not published { ""isPublished"": false , ""title"": ""Overcoming Bias in Recruiting to Create a Culture of Diversity & Inclusion"", ""author"": 1, ""timestamp"": 1531522701000 } The response code is 201, and when converted to JSON , the response body is: { ""id"": 1, ""isPublished"": false , ""title"": ""Overcoming Bias in Recruiting to Create a Culture of Diversity & Inclusion"", ""author"": 1, ""timestamp"": 1531522701000 } This adds a new object to the collection with the given properties and id 1. POST request to / posts Request body: When post is published { ""isPublished"": true , ""title"": ""Overcoming Bias in Recruiting to Create a Culture of Diversity & Inclusion"", ""author"": 1, ""timestamp"": 1531522701000 } The response code is 201, and when converted to JSON , the response body is: { ""id"": 1, ""isPublished"": true , ""title"": ""Overcoming Bias in Recruiting to Create a Culture of Diversity & Inclusion"", ""author"": 1, ""timestamp"": 1531522701000, ""publishedDate"": 1598779915685 } This adds a new object to the collection with the given properties and id 1. GET request to /posts The response code is 200, and when converted to JSON , the response body (assuming that the below objects are all objects in the collection) is as follows: [ { ""isPublished"": true , ""title"": ""Overcoming Bias in Recruiting to Create a Culture of Diversity & Inclusion"", ""author"": 1, ""timestamp"": 1531522701000, ""publishedDate"": 1598779915685, ""id"": 1 }, { ""isPublished"": false , ""title"": ""Introducing HackerRanks First Virtual Career Fair"", ""author"": 2, ""timestamp"": 1521522701000, ""publishedDate"": null , ""id"": 2 } ] GET request to /posts ? author=1 The response code is 200, and when converted to JSON , the response body (assuming that the below objects are all objects matching the filter) is as follows: [ { ""isPublished"": true , ""title"": ""Overcoming Bias in Recruiting to Create a Culture of Diversity & Inclusion"", ""author"": 1, ""timestamp"": 1531522701000, ""publishedDate"": 1598779915685, ""id"": 1 } ] GET request to /posts ? author=2&isPublished=false The response code is 200, and when converted to JSON , the response body (assuming that the below objects are all objects matching the filter) is as follows: [ { ""isPublished"": false , ""title"": ""Introducing HackerRanks First Virtual Career Fair"", ""author"": 2, ""timestamp"": 1521522701000, ""publishedDate"": null , ""id"": 2 } ] GET request to /posts/2 The response code is 200, and when converted to JSON , the response body (assuming that the object with id as 2 exists) is as follows: { ""isPublished"": false , ""title"": ""Introducing HackerRanks First Virtual Career Fair"", ""author"": 2, ""timestamp"": 1521522701000, ""publishedDate"": null , ""id"": 2 } If an object with id 2 doesn't exist , then the response code is 404 with the response body having the text ID not found. DELETE request to /posts/1 The response code is 405 and there are no particular requirements for the response body . PUT request to /posts/1 The response code is 405 and there are no particular requirements for the response body . PATCH request to /posts/1 The response code is 405 and there are no particular requirements for the response body .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/9n6op2o10hb/files/cf57965a597a840b78682b89df080485/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "blog_posts_api_medium should create a published post", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should create an unpublished post", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should fetch all the posts", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should fetch all the posts if the isPublished filter value does not exist", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should fetch all posts for an author", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should fetch no posts if author filter value does not exist", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should fetch all published posts for an author", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should fetch all unpublished posts for an author", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should fetch a single post", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should get 404 if the post ID does not exist", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should get 405 for a put request to /posts/:id", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should get 405 for a patch request to /posts/:id", "type": "junit", "weight": 0.07692307692307693}, {"file": "unit.xml", "name": "blog_posts_api_medium should get 405 for a delete request to /posts/:id", "type": "junit", "weight": 0.07692307692307693}]
['unit.xml']
13
909,065
NodeJS: API Aggregator Service
fullstack
In this challenge , your task is to implement an ExpressJS based API Aggregator service . The goal to communicate with various APIs , accumulate the responses and return a consolidated transformed response . The app accepts a single request to the endpoint /users/:userName . The response to be returned should be fetched from 2 different API sources detailed as follows: 1. User Details The user details should be fetched from the API https://jsonmock . hackerrank . com/api/articleusers ? username=<USERNAME> where <USERNAME> is the parameter passed to the request . The response from the external API is a JSON object having the following structure: { page: 1, perpage: 10, total: 1, totalpages: 1, data: [ // Data contains the list of users matching the username . If the data for the username is present , the array will contain only one object . { ""id"": 1, ""username"": ""epaga"", ... } ] } If the username passed to the request does not exist in the external system , the data array will be empty . In such a scenario , the local API should respond with a status code of 404 with the response body having the text as ""Username Not Found"". 2. User Transactions If the user details is successfully fetched from the First API , use the ID property of the details object(received in above API call) to fetch the paginated transactions for the user . The API to fetch the list of paginated transactions is https://jsonmock . hackerrank . com/api/transactions ? page=<PAGE>&userId=<USERID> where <PAGE> is the numeric page number to fetch the paginated data from the API and the <USERID> should match with the ID property fetched from the First API . The response from the transactions API has the following format: { page: 1, perpage: 10, total: 1, totalpages: 1, data: [ // Data contains the list of user transaction matching the user ID . { ""id"": 8, ""userId"": 4, ""userName"": ""Francesco De Mello"", ""timestamp"": 1548805761859, ""txnType"": ""credit"", ""amount"": ""1,214.44"", ... } ] } The response structure from the second API can be described as follows: page : The current page number of the response (Number) perpage : The total number of items in a single page . This property is immutable . (Number) total : The total number of transactions matching the filter criteria (Number) totalpages : The total number of pages containing the results for the filter criteria(Number) data : The Array containing a list of transactions matching the filter criteria (Array of objects) Further pages of the paginated APIs can be accessed by modifying the page value in the request . Eg: https://jsonmock . hackerrank . com/api/transactions ? page=2&userId=<USERID> Using the responses from both the API sources , a new transformed response has to be constructed and returned back in the response body . Here is an example of the final response object: { ""user"": { ""id"": 6, ""username"": ""saintamh"", ""about"": """", ""submitted"": 71, ""updatedat"": ""2019-09-06T11:13:29.000Z"", ""submissioncount"": 51, ""commentcount"": 15, ""createdat"": 1510174513 }, ""totalTransactions"": 67, ""summary"": [ { ""id"": 8, ""userId"": 6, ""userName"": ""Francesco De Mello"", ""timestamp"": 1548805761859, ""txnType"": ""credit"", ""amount"": ""1,214.44"", ""location"": { ""id"": 1, ""address"": ""948, Entroflex , Franklin Avenue"", ""city"": ""Ilchester"", ""zipCode"": 84181 }, ""ip"": ""35.151.1.82"" } ] } The response structure can be described as follows: user : The user details object fetched from the first API source(User) totalTransactions : The overall number of transactions for the user fetched from the second API(Number) summary : Only the first 3 transactions for the user fetched from the second API . Should be a blank array if there are no transactions for the user(Transactions Array) The task is to implement the REST service that exposes the /users/:userName endpoint . You should complete the given project so that it passes all the test cases when running the provided unit tests . The project includes the following npm packages pre-installed through npm . You are free to use any package to help with the API requests . 1. Axios 2. Request 3. Node Fetch 4. Bluebird Example requests and responses GET request to /users/epaga The response code is 200, and when converted to JSON , the response body is: { ""user"": { ""id"": 1, ""username"": ""epaga"", ""about"": ""Java developer / team leader at inetsoftware . de by day<p>iOS developer by night<p>http://www . mindscopeapp . com<p>http://inflightassistant . info<p>http://appstore . com/johngoering<p>[ my public key: https://keybase . io/johngoering; my proof: https://keybase . io/johngoering/sigs/I1UIk7t3PjfB5v2GI-fhiOMvdkzn370Z2iU5GitXa0 ]<p>hnchat:oYwa7PJ4Yaf1Vw9Om4ju"", ""submitted"": 654, ""updatedat"": ""2019-08-29T13:45:12.000Z"", ""submissioncount"": 197, ""commentcount"": 439, ""createdat"": 1301039509 }, ""totalTransactions"": 79, ""summary"": [ { ""id"": 1, ""userId"": 1, ""userName"": ""John Oliver"", ""timestamp"": 1549536882071, ""txnType"": ""debit"", ""amount"": ""1,670.57"", ""location"": { ""id"": 7, ""address"": ""770, Deepends , Stockton Street"", ""city"": ""Ripley"", ""zipCode"": 44139 }, ""ip"": ""212.215.115.165"" }, ... ] } GET request to /users/replicatorblog The response code is 200, and when converted to JSON , the response body is: { ""user"": { ""id"": 8, ""username"": ""replicatorblog"", ""about"": ""https://twitter . com/josephflaherty<p>Formerly Wired:<p>https://www . wired . com/author/joseph-flaherty/<p>Now covering startups for Founder Collective , a fantastic VC firm:<p>http://www . foundercollective . com/"", ""submitted"": 1441, ""updatedat"": ""2019-09-06T02:06:35.000Z"", ""submissioncount"": 550, ""commentcount"": 790, ""createdat"": 1224455310 }, ""totalTransactions"": 0, ""summary"": [] } GET request to /users/alliam The response code is 404, as no such user exists and the response body is the string ""Username Not Found"".
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/5c4f0dk0snd/files/01ff6e603b42e897bffec87f981c10d6/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "aggregator_service should fetch the details for a user", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "aggregator_service should fetch the count of transactions for the user", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "aggregator_service should fetch the first 3 transactions for the user", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "aggregator_service should return 404 if the user details are not found", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "aggregator_service should return the user object for a user with no transactions", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "aggregator_service should return the user object for another user", "type": "junit", "weight": 0.16666666666666666}]
['unit.xml']
6
909,381
NodeJS: Parking Spot
fullstack
As a NodeJS developer in your company , you have been given the responsibility to create an application that maintains the Car Parking Slots of the company . Implement the module parking . js such that the application has following set of functionalities: The file should export a class Parking as the default export of the module , and it should inherit from the EventEmitter class . The constructor of the classinitialises thenumber of slots available which defaults to 5. Itoptionally accepts a parameter , anumber , and assigns number of slots using this value if itis passed . The constructor should initialise a list of size equivalent to the number of slots available , and if a car is not assigned to aslot at any point in time , the correspondingslot should have a null value in the list . The class should have the following methods: parkCar : Accepts an object having the property carNumber as a parameterand assigns this car to the first empty slot available . If no slots are available for parking , the class should emit a 'parkingfull' event , with an object having the property carNumber havingvalue same as the carNumber from parameter , sent as the payload to the callback function . Else , if the parking operation was successful , the class should emit a 'parkingstarted' event , with an object having the property carNumber havingvalue same as the carNumber from parameter , sent as the payload to the callback function Parameter to this function has following structure: { carNumber : 'CAR-3' (String or Number) } getList : Returns the current state of the slots . If a slot is not occupied , the corresponding index in the array should have a null value , else it should contain the car number of the vehicle . remove : Accepts a single parameter carNumber (string or number). If the vehicle having the same carNumber is parked in one of the slots , removes its assignment from the list and reallocatenull value to the slot which just became empty . If the car is removed from the parking , the class should emit a 'parkingremoved' event , with an object having the property carNumber havingvalue same as the carNumber from parameter , sent as the payload to the callback function . Else if , no matching cars are parked with the carNumber passed , the class should emit a 'invalidnumber' event , with an object having the property carNumber havingvalue same as the carNumber from parameter , sent as the payload to the callback function NOTE: You can assume that the carNumber passed to the parkCar function is always unique and you do not have handle this scenario . The file index . js is present with an example implementation of this class that can be used to validate if the class works as expected . The Example output of this file is mentioned below . Test Requirements The parking . js file should export the class Parking as the default export of the module . Make sure that the carNumber passed to the parkCar method is valid (Number , String). The default number of slots of the class should be 5. Test cases take care of emitting interval event with only positive numbers . So any kind of validation on numbers is not required . Example Output Parking Started: CAR - 10 Parking Started: CAR - 20 Parking Started: CAR - 30 Parked at slot 1: CAR - 10 Parked at slot 2: CAR - 20 Parked at slot 3: CAR - 30 Slot 4 is empty Slot 5 is empty Car number CAR - 20 removed from parking . Parking Started: CAR - 40 Parking Started: CAR - 50 Parking Started: CAR - 60 Parking Full: CAR - 70 Parked at slot 1: CAR - 10 Parked at slot 2: CAR - 40 Parked at slot 3: CAR - 30 Parked at slot 4: CAR - 50 Parked at slot 5: CAR - 60 Car: CAR - 70 not found . Are you sure that you parked it here ?
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/93rjd6ihd6a/files/cc5b19890e4cee9725f65cc7f2a8d673/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "parking_slot \"before each\" hook for \"Should have all the methods in the class\"", "type": "junit", "weight": 0.5}, {"file": "unit.xml", "name": "parking_slot \"after each\" hook for \"Should have all the methods in the class\"", "type": "junit", "weight": 0.5}]
['unit.xml']
8
909,605
NodeJS: Editor History
fullstack
As a NodeJS developer in your company , you have been given the responsibility to create an image editor history stack that processes and accumulates the updates passed to it and flushes the updates at a fixed interval asynchronously . Implement the module history . js such that it has following set of functionalities: The file should export a class EditorHistory as the default export of the module , and it should inherit from the EventEmitter class . The class should have the following methods: constructor : Initializes the stack . push :Accepts the itemas an argument and sets it at the end of the stack . Emits the pushed event , with the item that was added sent as the payload to the callback function . undo : Removes the last item from the stack . Emits the undo event , with the item that was removedsent as the payload to the callback function . print : Returns the current items in the stack as an array . getCurrentInterval : Returns the current interval set for flushing the items periodically . Initially , the default interval for flushing the items is set to 250ms . start : Starts the process of flushing the data . The item at the end of the stack should be flushed at the specified time interval . Every time an item is flushed , emit a ' flushed 'eventwith the item that was flushed sent as the payload to the callback function . stop : Stopsthe flushing process . If the stack is empty at the time the timer has expired (default: every 250ms), nothing should be flushed and emitted , and the instance should keep listening for new items to be added without stopping . The class should listen to the interval event . The data to this event passed is a positive number which indicates a new interval value . Update the interval of processing immediately to this new interval value . The file index . js is present with an example implementation of this class and can be used to validate if the class works as expected . The Example output of this file is mentioned below . Test Requirements The history . js file should export the class EditorHistory as the default export of the module . Make sure that the items passed to the push method are valid (Number , String , Object only). The default interval for flushing the items is set to 250ms initially . Test cases take care of emitting interval event with only positive numbers . So any kind of validation on numbers is not required . Example Output Pushed: addlayer Pushed: applylayermask Pushed: hidelayermask [ 'addlayer', 'applylayermask', 'hidelayermask' ] Item removed after undo hidelayermask [ 'addlayer', 'applylayermask' ] [ 'addlayer', 'applylayermask' ] Flushed Item: applylayermask Flushed Item: addlayer At 2000ms At 2500ms Pushed: filllayer Flushed Item: filllayer Pushed: applytransformation Pushed: deletelayer At 4000ms [ 'applytransformation', 'deletelayer' ] At 5000ms [ 'applytransformation', 'deletelayer' ]
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/25ii0ha7kms/files/00a3dc833559273fe445e4d0ab6c79ed/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "editor_history_stack \"before each\" hook for \"Should have all the methods in the class\"", "type": "junit", "weight": 0.5}, {"file": "unit.xml", "name": "editor_history_stack \"after each\" hook for \"Should have all the methods in the class\"", "type": "junit", "weight": 0.5}]
['unit.xml']
8
909,946
NodeJS: Rate Limiter Middleware
fullstack
As the NodeJS developer in your company , you are required to write an ExpressJS Rate Limiting middleware to throttle the API traffic for the app to make sure that the app runs at full efficiency . The middleware should implement the following functionalities: Implement the rate-limiter . js middleware module . The module should export the class RateLimiter by default . This class must have a method named 'apply' which acts as the express middleware function . This class has 2 member variables , 'limit', and 'windowMs'. The significance of these members are described below: windowMs : The period of time in which an IP address can hit a particular number of requests (numeric window size in milliseconds). [Number] limit : The number of requests each IP address can hit in a period of time defined by the 'windowMs' parameter . The default value for limit property is 5 and the default value for windowMs is 1000 milliseconds . This translates to the Rate Limit of 5 request per second per IP address . Rate Limit Example: 20 requests per 5 seconds per IP Address | | limit windowMs (5000 milliseconds) The classoptionally accepts an object containing the properties , 'limit', and 'windowMs'. If it is present , use this object to assign the values to members ' windowMs' and 'limit'. (Or else use default values). This middleware should be initialized and the apply methods should be stacked to the GET '/tasks' route of the app to make sure that the number of requests to this route for a user by their IP address is within the limits specified . If the current request has crossed the limits specified , the server should return the response with the status code 429 with no particular requirement on the response body . In this case , the control should not be passed to the next function of the middleware . If the current request is valid and within the limits specified , a header 'x-limit-remaining' should be added to the response with the value as the number of requests remaining before the limit in the current window is reached . The control should be passed to the next function . For a particular IP address , when limit is reached in a window , for the request to go through again , difference between the current time and the time of thelast request that passed , should be greater than or equal to windowMs . The IP address for the request can be extracted from the 'req . ip' property of the request object passed to the middleware . For testing , the app has 'trust proxy' enabled and this the 'x-forwarded-for' header can be used to send a request using different IP addressed . The value of this header will be set as the 'req . ip' property of the request object . Note: Please make sure to properly set the context for the apply method which will be used as the middleware function . Test Requirements The middleware classshould be written in the file rate-limiter . js , and it should be the default export for the file . This class should have a method named apply which will be used as the middleware function . The function must call the next() function if the request is successful . Please use one of 'res . set' or 'res . setHeader' methods of the express to set the header in the response object . Please use the 'res . status' method chained with the 'send' method of the response object to return the response . res . status(STATUSCODE). send('YOURBODY'); Examples Let's look at some examples: Rate Limit: 4 Req/Sec Let's assume each request comes at 0.2 second intervals Window size: 1 second At 0.2 seconds , Req 1 ---------------------- IP : 192.168.0.1 Valid: No entry for this IP address exists yet and buffer is for 4 requests in 1 second . Response Header: x-limit-remaining = 3 As now only 3 more requests can be hit before the rate limit is reached At 0.4 seconds , Req 2 ---------------------- IP : 192.168.0.1 Valid: The entry for IP exists but its limit is 4 while this is only the 2nd request in this window . Response Header: x-limit-remaining = 2 At 0.6 seconds , Req 3 ---------------------- IP : 192.168.0.1 Valid: The entry for IP exists but its limit is 4 while this is only the 3rd request in this window . Response Header: x-limit-remaining = 1 At 0.8 seconds , Req 4 ---------------------- IP : 192.168.0.1 Valid: The entry for IP exists but its limit is 4 but this is the last request for this IP in this window . Response Header: x-limit-remaining = 0 At 1 seconds , Req 5 ---------------------- IP : 192.168.0.1 Invalid: The limit for this request has been reached . Response Status: 429 This IP address has to wait the equivalent of 1 unit of window size to get a valid response again . Thus the next valid request can only be sent for this IP 1 second later . At 1 seconds , Req 1 for different IP ---------------------- IP : 192.168.0.2 Valid: No entry for this IP address exists yet and buffer is for 4 requests in 1 second . Response Header: x-limit-remaining = 3
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/2nr8rocm2s8/files/2b8123bbb796a0c6ce4258488e0f9623/project.zip
nodejs18_15
npm test
[{"file": "unit.xml", "name": "express_rate_limit_middleware should have the rate limit remaining header in the response", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_rate_limit_middleware should allow the request until the window limit has been reached", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_rate_limit_middleware should reset the time after window has been reset", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_rate_limit_middleware should track rate limits based on ip address of the user", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_rate_limit_middleware should work with different values of limit and windowMs", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "express_rate_limit_middleware should work with correct status codes", "type": "junit", "weight": 0.16666666666666666}]
['unit.xml']
6
942,595
Angular: Company Validation
fullstack
Create a Company Form Validation component as shown below: Hide animation Show animation The component should perform the following validations for a company form: The Company title input field is required . The messageshould be rendered only when the field is not valid , so on app load , it should not be rendered . The field is required . For this error show the message 'Company title is required'. The message should be shown in <pdata-test-id=""title-input-error""></p> . The Number of employeesinput field should pass following validations . The messageshould be rendered only when the field is not valid , so on app load , it should not be rendered . The field is optional . No error is triggered if there is no value . If value is entered , number should be greater than 0. For this error show the message 'Number of employees should be greater than 0'. The message should be shown in <pdata-test-id=""employees-count-input-error""></p>. When fields are invalid , the submit button should be disabled . Initially , the button is disabled . Validations are triggered when input fields are touched for the first time . When all fields are valid and touched , the submit button should be enabled . To achieve the interface as shown in the demo , when validation fails , add the class error to inputs . Please note that this is not a requirement and is only for CSS purposes . Tests do not test this . The following data-test-id attributes are required in the component for the tests to pass: The company title input:'title-input' The employees count input:'employees-count-input' The submit button:'submit-button' The container having the error message for : the company title input field:'title-input-error' the employees count input field:'employees-count-input-error' Please note that the component has these data-test-id attributes for test cases , certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/ag2l57r4s3n/stack/5opgc5llt73/1d5495cddad984570ed43ad80dda3c12.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "CompanyValidation Validation that title's min length should be 3 works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "CompanyValidation Validation that title is required works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "CompanyValidation Validation that employees count is required works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "CompanyValidation initial UI is rendered as expected", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "CompanyValidation Validation that average salary should be greater than 0 works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "CompanyValidation Validation that title's max length should be 15 works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "CompanyValidation Validation that average salary is optional works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "CompanyValidation Validation that employees count should be greater than 0 works", "type": "junit", "weight": 0.1111111111111111}, {"file": "unit.xml", "name": "CompanyValidation Button should be enabled when all inputs are correct and no errors should be shown", "type": "junit", "weight": 0.1111111111111111}]
['unit.xml']
9
943,724
Angular: Product Validation
fullstack
Create a Product Form Validation component as shown below: Hide animation Show animation The component should perform the following validations for a product form: The Product name input field is required . A messageshould be rendered only when the field is not valid , soon app load , it should not be rendered . The field is required . For this error show the message 'Product name is required'. The message should be shown in <pdata-test-id=""name-input-error""></p>. The Quantityinput field should pass following validations . A messageshould be rendered only when the field is not valid , soon app load , it should not be rendered . The field is required . For this error show the message 'Quantity is required'. The message should be shown in <pdata-test-id=""quantity-input-error""></p>. When fields are invalid , the submit button should be disabled . Initially , the button is disabled . Validations are triggered when input fields are touched for the first time . When all fields are valid and touched , the submit button should be enabled . To achieve the interface as shown in the demo , when validation fails , add the class error to inputs . Please note that this is not a requirement and is only for CSS purposes . Tests do not test this . The following data-test-id attributes are required in the component for the tests to pass: The product name input:'name-input' The quantity input:'quantity-input' The submit button:'submit-button' The container having the error message for : the product name input field:'name-input-error' the quantity input field:'quantity-input-error' Please note that the component has these data-test-id attributes for test cases , certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/2ijgfnmlda/stack/8g45tk0rfqk/3e332657baa92eb8a4fa70905013d59c.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "ProductValidation Validation that name's min length should be 3 works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "ProductValidation Validation that name is required works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "ProductValidation Button should be enabled when all inputs are correct and no errors should be shown by performing series of operations", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "ProductValidation Validation that quantity is required works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "ProductValidation Validation that quantity should not be more than 500 works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "ProductValidation Validation that name should only contain letters or spaces works", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "ProductValidation initial UI is rendered as expected", "type": "junit", "weight": 0.125}, {"file": "unit.xml", "name": "ProductValidation Validation that quantity should be greater than 0 works", "type": "junit", "weight": 0.125}]
['unit.xml']
8
944,191
Angular: Flight Search
fullstack
Create a Flight Search component , as shown below: Hide animation Show animation Thecomponent must have the following functionalities: The component receives a prop , flightOptions , which is an array of flightobjects . The flight object has the following interface: interface FlightDetail { source: string; destination: string; price: string; departure: string; arrival: string; duration: string; } The componentrenders two text input fields: Source input Destination input The component has a Search button . Clicking on this button should search in flightOptions prop to find objects for which source and destination match the inputs . In the tests , allsource and destination values passed in props are in lower case . For the matched flights , render the flight information as an individual row in the table body <tbody data-test-id=""flight-results"">. The matched flights tablebody should only be rendered when matches exist after the Search button is clicked . It should be not be rendered initially . If no matches exist , render <div data-test-id=""no-flights"">No flights found</div> instead of the matched flights table body . This div should onlybe rendered when no matches exist after the Search button is clicked . It should be not be rendered initially . The following data-test-id attributes are required in the component for the tests to pass: The source input:'source-input' The destination input:'destination-input' The search button:'search-button' The matched flights table body: 'flight-results' The no flights found div: 'no-flights' Please note that the component has these data-test-id attributes for test cases , certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/7bhn53m9jcj/stack/d7qi07ji4t9/a02ff463f003114da416f123367d0757.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "FlightSearch Flight search works as expected - search 2", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "FlightSearch initial UI is rendered as exptected", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "FlightSearch Flight search works as expected - search 1", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "FlightSearch Perform series of operation", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "FlightSearch Shows No Flights Found when no matches found", "type": "junit", "weight": 0.2}]
['unit.xml']
5
944,399
Angular: Order Directory
fullstack
Create an Order Directory module as shown below: Hide animation Show animation The module should have the following functionalities: The module has 2 components: OrderDirectory component OrderForm component The app has a service namedApp Service which can be used to store the list of Orders globally . The interface for an Order has been defined in this file having the following structure: interface Order { id: string; status: string; } In the OrderDirectory component - There are order id and order status text inputs . Both are initially empty . Clicking on the Submit button should add the order with this id and statusto the app service . After addition , reset both the input values . If either of the fields is empty , clicking on the Submit button should not do anything . For testing , no duplicate ids will be submitted . In the OrderForm component - Render all the orders that are saved in the app service . Each order is rendered as a row inside order table body <tbody data-test-id=""order-list"">. The following data-test-id attributes are required in the component for the tests to pass: The order id input: 'id-input' The order status input:'status-input' The submit button: 'submit-button' The order table body: 'order-list' Please note that the component has these data-test-id attributes for test cases , certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/21gk7ethbp2/stack/4h7k37cchbm/3b73d0f66de5766b899be9c36e8cd71a.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "AppComponent Perform series of operations", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Updating order in order directory works", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Inputs should reset once order is added", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Nothing happens if either field is empty", "type": "junit", "weight": 0.2}, {"file": "unit.xml", "name": "AppComponent Adding order to order directory works", "type": "junit", "weight": 0.2}]
['unit.xml']
5
944,574
Angular: Project Tracker
fullstack
Kanban is a popular workflow used in task management , project management , issue tracking , and for similar purposes . The workflow is usually visualized using a Kanban Board . Create a Project Trackercomponent similar to Kanban with tasks , where each task consists of a name only , as shown below: Hide animation Show animation The component must have the following functionalities: The board contains 2 stages of tasks in the sequence 'In Progress', and 'Completed'. The app has a service named AppService which is used to store the list of tasks globally . It has member object named taskList , a collection oftasks that needs to be rendered on app load . The member object taskList and the interface for a single Task has been defined in this file with the following structure: taskList: Task[][]; // 2D array interface Task { name: string; } A taskList object is a 2d array in which: The array at the 0 th indexis the collection of tasks in the 'In Progress' stage . The array at the 1 st index is the collection of tasks in the 'Completed' stage . In each stage , the tasks are rendered as an unordered list <ul>, where each task is a single list item <li> that displays the name of the task . Each task list item has 2 icon buttons on the right: Back button: This moves the task to the previous stage in the sequence , if any . This button is disabled if the task is in the first stage . Forward button: This moves the task to the next stage in the sequence , if any . This button is disabled if the task is in the last stage . The following data-test-id attributes are required in the component for the tests to pass: The <ul> for the 'In Progress' stage: 'stage-0' The <li> inside this <ul> has id attributes of 'stage-0-task-0', 'stage-0-task-1', 'stage-0-task-2' and so on . The <ul> for the 'Completed' stage: 'stage-1' The <li> inside this <ul> has id attributes of 'stage-1-task-0', 'stage-1-task-1', 'stage-1-task-2' and so on . The <span> containing task name in each <li>: 'name' The back button in each <li>: 'back' The forward button in each <li>: 'forward' Please note that the component has these data-test-id attributes for test cases , certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/v1/3rd7dpblhkc/stack/75eq63l323m/e624acca6d495ef6403df3ac4ea2b8ac.zip
angularjs
bash bin/env_setup && . $HOME/.nvm/nvm.sh && npm test
[{"file": "unit.xml", "name": "ProjectTracker In Initial UI each stage has correct number of tasks", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "ProjectTracker Perform series of operations", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "ProjectTracker For tasks in stage 1, back button works correctly", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "ProjectTracker For tasks in stage 0, forward button works correctly", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "ProjectTracker In stage 0, correct task exists with back button disabled", "type": "junit", "weight": 0.16666666666666666}, {"file": "unit.xml", "name": "ProjectTracker In stage 1, correct task exists with forward button disabled", "type": "junit", "weight": 0.16666666666666666}]
['unit.xml']
6
945,334
React: Flight Search
fullstack
Create a Flight Search component , as shown below: Hide animation Show animation Thecomponent must have the following functionalities: The component receives a prop , flightOptions , which is an array of flightobjects . The flight object has the following interface: type FlightDetail { source: string; destination: string; price: string; departure: string; arrival: string; duration: string; } The componentrenders two text input fields: Source input Destination input The component has a Search button . Clicking on this button should search the flightOptions prop to find objects for which source and destination values matching the inputs . For testing , all source and destination values passed in props are in lower case . For all the matched flights , render the flight information as an individual row in the table body <tbody data-testid=""flight-results"">. The matched flights tablebody should only be rendered when matches exist after the Search button is clicked . Hence , it should be not be rendered initially . If no matches exist , then render <div data-testid=""no-flights"">No flights found</div>, instead of the matched flights table body . This div should be only be rendered when no matches exist after the Search button is clicked . Hence , it should be not be rendered initially . The following data-testid attributes are required in the component for the tests to pass: The source input:'source-input' The destination input:'destination-input' The search button:'search-button' The matched flights table body: 'flight-results' The no flights found div: 'no-flights' Please note that the component has these data-testid attributes for test cases , certain classes and ids for rendering purposes . They should not be changed .
https://istreet-proctor.s3.amazonaws.com/fullstack/questions/75onntcgh8/files/5db781f49cc9f375de5074d437405838/project.zip
nodejs18_15__reactjs
npm test
[{"file": "junit.xml", "name": "initial UI is rendered as expected", "type": "junit", "weight": 0.2}, {"file": "junit.xml", "name": "Flight search works as expected - search 1", "type": "junit", "weight": 0.2}, {"file": "junit.xml", "name": "Flight search works as expected - search 2", "type": "junit", "weight": 0.2}, {"file": "junit.xml", "name": "Shows No Flights Found when no matches found", "type": "junit", "weight": 0.2}, {"file": "junit.xml", "name": "Perform series of operation", "type": "junit", "weight": 0.2}]
['junit.xml']
5

Dataset Card for Astra-Benchmark v1

The dataset used for astra-benchmark v1 consists of multiple project questions, each with its own unique identifier and associated metadata. The dataset is stored in a CSV file named project_questions.csv located in the root directory of the project.

Structure of project_questions.csv

The CSV file should contain the following columns:

  • id: Unique identifier for each project.
  • name: Name of the project.
  • type: Type of project (e.g., "fullstack").
  • problem_statement: Description of the project's goal.
  • project_url: URL pointing to the project resource.
  • sub_type: Sub-category or framework used (e.g., "reactjs").
  • test_command: Command used for running tests.
  • testcases: JSON describing the test cases for the project.
  • testcase_files: Files used for test cases.
  • total_testcases: Number of test cases in the project.

Languages

The text in the dataset is in English. The associated BCP-47 code is en.

Downloads last month
46