JSFiddle - React, Tailwind, and code Playground

by Prathameshsb

JavaScript

const assert = require('chai').assert;
const FundingRaised = require('../funding_raised');

// Test suite for the FundingRaised class
describe('FundingRaised', () => {
  
  // Test suite for the 'where' method
  describe('#where', () => {
    
    // Sub-suite: company_name is Facebook
    describe('company_name is Facebook', () => {
      
      // Test: Ensure 'where' returns 7 results for Facebook
      it('returns 7 results', () => {
        const rows = FundingRaised.where({ company_name: 'Facebook' });
        assert.lengthOf(rows, 7);
      });

      // Test: Ensure 'where' returns the correct details for Facebook
      it('returns the correct result details', () => {
        const rows = FundingRaised.where({ company_name: 'Facebook' });
        const row = rows[0];

        assert.equal(row.permalink, 'facebook');
        assert.equal(row.company_name, 'Facebook');
        assert.equal(row.number_employees, '450');
        assert.equal(row.category, 'web');
        assert.equal(row.city, 'Palo Alto');
        assert.equal(row.state, 'CA');
        assert.equal(row.funded_date, '1-Sep-04');
      });
    });

    // Sub-suite: city is Tempe
    describe('city is Tempe', () => {
      
      // Test: Ensure 'where' returns 3 results for Tempe
      it('returns 3 results', () => {
        const rows = FundingRaised.where({ city: 'Tempe' });
        assert.lengthOf(rows, 3);
      });
    });

    // Sub-suite: state is CA
    describe('state is CA', () => {
      
      // Test: Ensure 'where' returns 873 results for CA
      it('returns 873 results', () => {
        const rows = FundingRaised.where({ state: 'CA' });
        assert.lengthOf(rows, 873);
      });
    });

    // Sub-suite: company_name is Facebook and round is a
    describe('company_name is Facebook and round is a', () => {
      
      // Test: Ensure 'where' returns 1 result for Facebook and round 'a'
      it('returns 1 result', () => {
        const rows = FundingRaised.where({...