*whispers*
- Heydon Pickering
I don’t understand tests. If my code breaks, I get errors. I know already.
I don’t really understand tests either tbh 😂
- Una Kravets
Marcy Sutton – Senior Front-End Engineer, Deque Systems
          http://marcysutton.com/smashingBCN17 – @marcysutton
...or no testing?
🤔The human mind has limits. We can only remember so many things; we can really only concentrate on one thing at a time.
- Jeff Sutherland
  it('should generate a table with multiple columns and rows', () => {
    const items = [['x', 'y'], ['a', 'b'], ['c', 'd']]
    const result = AsciiTable.table(items)
    expect(result).toEqual([
      '╒═══╤═══╕',
      '│"x"│"y"│',
      '╞═══╪═══╡',
      '│"a"│"b"│',
      '├───┼───┤',
      '│"c"│"d"│',
      '└───┴───┘'].join('\n'))
  })
            
            
  it('should take a node as a parameter and return an object', () => {
    var node = document.createElement('p');
    node.textContent = 'Do do do do doo....' +
      'Bum bum bum bum bum, bum bum bum...';
    var result = new DqElement(node);
    assert.isObject(result);
  });
            
            Unit testing is a balance between development velocity and ROI
Ashley Williams 💭
 it('should focus the next tab on [arrow right]', async function() {
   const found = await helper.pressKeyUntil(this.driver, Key.TAB, 
     _ => document.activeElement.getAttribute('role') === 'tab'
   );
   expect(found).to.be.true;
   await this.driver.executeScript(_ => {
     window.firstTab = document.querySelector('[role="tablist"] > [role="tab"]:nth-of-type(1)');
     window.secondTab = document.querySelector('[role="tablist"] > [role="tab"]:nth-of-type(2)');
   });
   await this.driver.actions().sendKeys(Key.ARROW_RIGHT).perform();
   const focusedSecondTab = await this.driver.executeScript(_ => 
     window.secondTab === document.activeElement
   );
   expect(focusedSecondTab).to.be.true;
 });
            
            There’s a gradient from unit to integration based on how many external things the test touches and how many of those you mock.
-Alex Early
  var person = {
    firstName: 'Kimmy',
    get userName() {
        return `@${this.firstName}`.toLowerCase();
    },
    set username (name) {
        var fragments = name.toString().split('@');
        this.firstName = fragments[1];
    }
  }
  person.username = '@aretha';
  console.log(person.firstName); // aretha
          
          Use tools to focus manual testing on exact component states requiring human attention
Visual Testing — the pragmatic way to test UIs
    var axe = require('axe-core');
    describe('Component accessibility', () => {
      var dropdown = new FancyDropdown();
      it('should have no violations on load', (done) => {
        axe.run(dropdown, {}, (err, results) => {
          expect(results.violations.length).toBe(0)
          done()
        })
      })
              it('should have no violations when opened', (done) => {
        dropdown.open();
        axe.run(dropdown, {}, (err, results) => {
          expect(results.violations.length).toBe(0)
          done()
        })
      })
    })
            
    var AxeBuilder = require('axe-webdriverjs'),
        WebDriver = require('selenium-webdriver');
    
    var driver = new WebDriver.Builder().build();
    describe('Homepage accessibility', () => {
      it('should have no violations', (done) => {    
        driver.get('https://localhost:3333')
          .then(function () {
            AxeBuilder(driver).analyze((results) => {
              expect(results.violations.length).toBe(0)
              done()
            })
          })
      })
    })