Skip to content

Exercise 6: the skipped tests don't line up with what you are expected to do #543

@Jacksonbryan28

Description

@Jacksonbryan28

Prerequisites

  • I have thoroughly read and understand The Odin Project Contributing Guide
  • I have searched the existing issues to ensure this improvement hasn't been suggested before (please have a look through our open issues list to make sure)
  • The title of this issue follows the <Location of the improvement>: <Brief description of the improvement> format, e.g. Exercises: Add exercise on XYZ
  • (Optional) I am interested in working on this issue and would like to be assigned to it

Improvement Description

In lesson 6 there are tests that are skipped that don't line up with what is asked in the readme.

The .skiped tests include giving an error if the output is a negative number.

test.skip('returns ERROR with negative numbers', () => {
expect(repeatString('goodbye', -1)).toEqual('ERROR');
});
test.skip('repeats the string a random amount of times', function () {
/* The number is generated by using Math.random to get a value from between
0 to 1, when this is multiplied by 1000 and rounded down with Math.floor it
equals a number between 0 to 999 (this number will change everytime you run
the test).

  DO NOT use Math.floor(Math.random() * 1000) in your code, 
  this test generates a random number, then passes it into your code with a function parameter.
  If this doesn't make sense, you should go read about functions here:
  https://www.theodinproject.com/paths/foundations/courses/foundations/lessons/fundamentals-part-3 */
const number = Math.floor(Math.random() * 1000);
expect(repeatString('hey', number)).toBe('hey'.repeat(number));

});
test.skip('works with blank strings', () => {
expect(repeatString('', 10)).toEqual('');
});

The readme does not mention this anywhere

Exercise 06 - repeatString

Write a function that simply repeats the string a given number of times:

repeatString("hey", 3); // returns 'heyheyhey'

This function will take two arguments, string and num.

Use loops to implement repeatString rather than using the builtin String.prototype.repeat which has the same behaviour.

Note: The exercises after this one will not have arguments provided as this one does - you will need to provide them yourself from now on. So read each exercise's README carefully to see what kinds of arguments will be expected.

Hints

  • Take note of the above function call- how exactly is it being called?

  • Create a variable to hold the string you're going to return, create a loop that repeats the given number of times and add the given string to the result on each loop.

I made another ticket about skips not being introduced into the readme as well.

Acceptance Criteria

[ ] remove skips that don't align with the readme
or
[ ] make it so the readme reflects what is expected from the test

(Optional) Additional Comments

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions