mathiasbynens / mathiasbynens/String.prototype.includes
Add more test cases in Array, Object
Nessuno ha ancora preso questa issue.
- Lingua principale
- JavaScript
- Stelle
- 70
- Fork
- 10
- Metriche di merge delle PR
- Nessuna PR unita negli ultimi 30g
Descrizione
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.
Guida per i contributori
Nessuna guida per i contributori indicizzata per questo repository
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Nell’issue non è indicato alcun file di test. Individua i test esistenti per String.prototype.includes e confronta il loro stile delle asserzioni con i casi proposti per Array e Object. Esegui prima quella suite di test, poi aggiungi la copertura per le conversioni mostrate e verifica che i casi passino.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- javascript
- Ambito
- testing-qa
- Tipo di issue
- Funzionalità
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100