mathiasbynens / mathiasbynens/String.prototype.includes
Add more test cases in Array, Object
Nadie ha tomado este issue todavía.
- Lenguaje dominante
- JavaScript
- Estrellas
- 70
- Forks
- 10
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Descripción
I understand that `searchString` is not accepted in RegExp. _(TypeError exception)_
> Throwing an exception if the first argument is a RegExp is specified in order to allow future editions to define extensions that allow such argument values.
But it does accept **Array** and **Object** through the method `toString` under the [specification](https://tc39.github.io/ecma262/#sec-string.prototype.includes).
which are
``` js
// array
['this', 'is', 'an', 'array'].toString(); // => 'this,is,an,array'
// object
({'obj': 'obj'}).toString(); // => '[object Object]'
```
Therefore, I would like to add more test cases
``` js
// array
assertEquals('this,is,an,array').includes(['this', 'is']), true);
assertEquals('this,is,an,array').includes(['this', 'is'], 1), false);
assertEquals('this, is, an, array').includes(['this', 'is']), false);
// object
assertEquals(String.prototype.includes.apply({ 'toString': function () { return '[object Object]'; }}, [{'obj': 'obj'}, 0]), true);
```
It’s weird if someone input the array or object to the method `includes`, but it does support.
Guía de contribución
No hay ninguna guía de contribución indexada para este repositorio
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Línea de trabajo
En el issue no se nombra ningún archivo de pruebas. Localiza las pruebas existentes para String.prototype.includes y compara su estilo de aserciones con los casos propuestos para Array y Object. Ejecuta primero esa suite de pruebas, luego añade cobertura para las conversiones mostradas y verifica que los casos pasen.
Escrito por el modelo de indexación a partir del texto del issue.
Evaluación
- Stack tecnológico
- javascript
- Área
- testing-qa
- Tipo de issue
- Nueva funcionalidad
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Estado de actividad
- Estancado
- Claridad
- Bastante claro
- Aptitud para principiantes
- 35/100