项目原始demo,不改动
Non puoi selezionare più di 25 argomenti Gli argomenti devono iniziare con una lettera o un numero, possono includere trattini ('-') e possono essere lunghi fino a 35 caratteri.
Questo repository è archiviato. Puoi vedere i file e clonarli, ma non puoi effettuare richieste di pushj o aprire problemi/richieste di pull.
 
 
 
 

33 righe
821 B

  1. describe( 'coalescy', function () {
  2. beforeEach( function () {
  3. this.coalesce = require( '../index' );
  4. } );
  5. it( 'should return the first non null value', function () {
  6. var result = this.coalesce( null, [] );
  7. expect( result ).to.deep.equal( [] );
  8. result = this.coalesce( null, {} );
  9. expect( result ).to.deep.equal( {} );
  10. result = this.coalesce( null, [], {} );
  11. expect( result ).to.deep.equal( [] );
  12. result = this.coalesce( null, undefined, 0, {} );
  13. expect( result ).to.equal( 0 );
  14. var a = null,
  15. b,
  16. c = 0,
  17. d = 1;
  18. result = this.coalesce( a, b, c, d );
  19. expect( result ).to.equal( 0 );
  20. } );
  21. it( 'should return null when no arguments are passed', function () {
  22. var result = this.coalesce();
  23. expect( result ).to.equal( null );
  24. } );
  25. } );