How to use the mocha.describe function in mocha

To help you get started, we’ve selected a few mocha examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github garriguv / soundcloudql / src / schema / __tests__ / track.js View on Github external
import { expect } from 'chai';
import { describe, it } from 'mocha';
import { soundcloud } from './soundcloudql';

/* eslint-disable max-len */

describe('Track type', function () {
  it('Gets an object by id', function () {
    var query = '{ track(id: 2) { title }}';
    return soundcloud(query).then(function (result) {
      expect(result.data.track.title).to.equal('Electro 1');
    });
  });

  it('Gets all properties', function () {
    var query = `
{
  track(id: 2) {
    id
    title
    createdAt
    description
    commentCount
github zhilu-nanjing / financial-cell / test / core / errorPop_test_scsslint_tmp5591952202215759686.js View on Github external
it('  1.23.23  ', function () {
            let formatProxy = new FormatProxy();
            let _cell = formatProxy.makeFormatCell({text: "1.23.23", formula: "1.23.23"}, {
                symbol: "%",
                position: "end"
            }, (s) => {
                return calcDecimals(s, (s2) => {
                    return s2 * 100;
                });
            });
            assert.equal(_cell, null);
        });
    });

    describe('  special_formula_process  ', () => {
        it('  *HYPERLINK*/*MULTIPLECELLS*  ', function () {
            // let args = specialWebsiteValue('*HYPERLINK*!{"text":"www.baidu.com","url":"www.baidu.com"} ', "=ADD()");
            // assert.equal(args.state, true);
            // assert.equal(args.text, "www.baidu.com");
            // assert.equal(args.type, 2);
            //
            // let wb = {
            //     "A1": {
            //         "v": "1",
            //         "f": "1"
            //     },
            //     "B1": {
            //         "v": "2",
            //         "f": "2"
            //     }
            // }
github zodern / meteor-up / src / plugins / proxy / __tests__ / index.js View on Github external
expect(out.output).to.have.entriesCount('mup-nginx-proxy-letsencrypt', 1);

      out = await runSSHCommand(serverInfo, 'du --max-depth=2 /opt');
      expect(out.output).to.have.entriesCount('/opt/mup-nginx-proxy', 4);
      expect(out.output).to.have.entriesCount('/opt/mup-nginx-proxy/certs', 1);
      expect(out.output).to.have.entriesCount('/opt/mup-nginx-proxy/mounted-certs', 1);
      expect(out.output).to.have.entriesCount('/opt/mup-nginx-proxy/config', 1);

      out = await runSSHCommand(serverInfo, 'ls /opt/mup-nginx-proxy/config');
      expect(out.output).to.have.entriesCount('shared-config.sh', 1);
      expect(out.output).to.have.entriesCount('env.list', 1);
      expect(out.output).to.have.entriesCount('env_letsencrypt.list', 1);
    });
  });

  describe('reconfig-shared', () => {
    it('it should update shared settings', async () => {
      const serverInfo = servers.mymeteor;
      sh.cd(path.resolve(os.tmpdir(), 'tests/project-3'));
      sh.exec('mup setup');

      let out = sh.exec('mup proxy reconfig-shared');
      expect(out.code).to.equal(0);
      expect(out.output).to.have.entriesCount('Configuring Proxy\'s Shared Settings', 1);
      expect(out.output).to.have.entriesCount('Start proxy: SUCCESS', 1);

      out = await runSSHCommand(serverInfo, 'cat /opt/mup-nginx-proxy/config/shared-config.sh');
      expect(out.output).to.have.entriesCount('CLIENT_UPLOAD_LIMIT=10M', 1);
    });
  });

  describe('logs', () => {
github finer-vision / Validation / tests / validators.js View on Github external
describe('US Mobile', () => {
        const rule = 'us_mobile';

        it('passes validation if the field is a valid US mobile number', () => {
            const validator = validation.validate({field: '(541) 754-3010'}, {field: 'us_mobile'});
            equal(validator.verdict.field[rule].passed, true);
        });

        it('fails validation if the field is not a valid US mobile number', () => {
            const validator = validation.validate({field: '(5413) 754-3010'}, {field: 'us_mobile'});
            equal(validator.verdict.field[rule].passed, false);
        });
    });

    describe('UK Postcode', () => {
        const rule = 'uk_postcode';

        it('passes validation if the field is a valid UK postcode', () => {
            const validator = validation.validate({field: 'SE1 0HG'}, {field: 'uk_postcode'});
            equal(validator.verdict.field[rule].passed, true);
        });

        it('fails validation if the field is not a valid UK postcode', () => {
            const validator = validation.validate({field: 'SE12Z 0HG'}, {field: 'uk_postcode'});
            equal(validator.verdict.field[rule].passed, false);
        });
    });

    describe('US Postcode', () => {
        const rule = 'us_postcode';
github ahiipsa / zerg / test / zerg.js View on Github external
});

        it('should not throw when delete transport', function () {
            var transport = sinon.spy();
            zerg.addTransport(transport);
            expect(function () {
                zerg.removeTransport(transport);
            }).not.throws();
        });

        it('should not throw when delete NOT existing transport', function () {
            zerg.removeTransport(function () {});
        });
    });

    describe('zerg.removeAllTransport', function () {
        it('should delete all transports', function() {
            var t1 = sinon.spy();
            var t2 = sinon.spy();

            zerg.addTransport(t1);
            zerg.addTransport(t2);
            zerg.removeAllTransports();

            zerg.module('temp1').info('some message');

            expect(t1).not.called;
            expect(t2).not.called;
        });

        it('should not throw error', function() {
            expect(function () {
github graphql / graphql-js / src / language / __tests__ / visitor.js View on Github external
*  of patent rights can be found in the PATENTS file in the same directory.
 */

import { expect } from 'chai';
import { describe, it } from 'mocha';
import { parse } from '../parser';
import { print } from '../printer';
import { readFileSync } from 'fs';
import { visit, visitInParallel, visitWithTypeInfo, BREAK } from '../visitor';
import { join } from 'path';
import { TypeInfo } from '../../utilities/TypeInfo';
import { testSchema } from '../../validation/__tests__/harness';
import { getNamedType, isCompositeType } from '../../type';


describe('Visitor', () => {
  it('allows for editing on enter', () => {

    const ast = parse('{ a, b, c { a, b, c } }', { noLocation: true });
    const editedAst = visit(ast, {
      enter(node) {
        if (node.kind === 'Field' && node.name.value === 'b') {
          return null;
        }
      }
    });

    expect(ast).to.deep.equal(
      parse('{ a, b, c { a, b, c } }', { noLocation: true })
    );

    expect(editedAst).to.deep.equal(
github zotoio / github-task-manager / test / serverless / gtmGithubHook / gtmGithubHook.spec.js View on Github external
describe('gtmGithubHook', function() {
    describe('decodeEventBody', function() {
        it('should remove prefix and parse body', function(done) {
            let expected = { action: 'test' };
            let event = {};
            event.body = 'payload=%7B%22action%22%3A%20%22test%22%7D';

            let actual = gtmGithubHook.decodeEventBody(event);
            assert.equal(actual.action, expected.action);
            done();
        });
    });
    describe('listener', function() {
        it('should run', function(done) {
            let event = {};
            event.type = 'pull_request';
            event.body = 'payload=%7B%22action%22%3A%20%22test%22%7D';
github zodern / meteor-up / src / plugins / meteor / __tests__ / swarm.js View on Github external
});

  describe('start', () => {
    it('should create service', async () => {
      cdSwarmProject();
      sh.exec(
        'mup setup && mup meteor push --cached-build'
      );

      const out = sh.exec('mup meteor start');

      expect(out.code).to.equal(0);
      await checkRunning();
    });
  });
  describe('stop', () => {
    it('should remove service', async () => {
      const serverInfo = servers.mymeteor;

      cdSwarmProject();
      sh.exec(
        'mup setup && mup meteor deploy --cached-build'
      );

      const out = sh.exec(
        'mup meteor stop'
      );

      expect(out.output).to.have.entriesCount('Stop myapp-service: SUCCESS', 1);

      const sshService = await runSSHCommand(
        serverInfo,
github choonchernlim / front-end-stack / src / js / app / reducers / __tests__ / chuckNorris-spec.js View on Github external
describe('Reducer', () => {
    describe('Default', () => {
      it('given unknown action, should return initial state', () => {
        expect(chuckNorrisReducer(undefined, { type: 'UNKNOWN' })).to.deep
          .equal(makeChuckNorrisState());
      });
    });

    describe('GET_JOKE', () => {
      it('when getting joke, should set completed to false', () => {
        const initialState = makeChuckNorrisState({
          completed: true,
          joke: 'joke',
        });

        const actualState = chuckNorrisReducer(initialState, chuckNorris.getJoke());
        const expectedState = makeChuckNorrisState({ completed: false });
github googleapis / nodejs-talent / test / gapic-v4beta1.js View on Github external
client._innerApiCalls.completeQuery = mockSimpleGrpcMethod(
        request,
        null,
        error
      );

      client.completeQuery(request, (err, response) => {
        assert(err instanceof Error);
        assert.strictEqual(err.code, FAKE_STATUS_CODE);
        assert(typeof response === 'undefined');
        done();
      });
    });
  });
});
describe('EventServiceClient', () => {
  it('has servicePath', () => {
    const servicePath = talentModule.v4beta1.EventServiceClient.servicePath;
    assert(servicePath);
  });

  it('has apiEndpoint', () => {
    const apiEndpoint = talentModule.v4beta1.EventServiceClient.apiEndpoint;
    assert(apiEndpoint);
  });

  it('has port', () => {
    const port = talentModule.v4beta1.EventServiceClient.port;
    assert(port);
    assert(typeof port === 'number');
  });