How to use the chai.assert.isString function in chai

To help you get started, we’ve selected a few chai 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 DonutEspresso / base-n / test / index.js View on Github external
assert.lengthOf(x, 5);

            b64 = baseN.create({
                length: 2
            });
            x = b64.encode(5);
            assert.isString(x);
            assert.lengthOf(x, 2);

            // can also fix length by giving a max integer value allowed.
            // this should be two characters. (64^2)
            b64 = baseN.create({
                max: 4095
            });
            x = b64.encode(5);
            assert.isString(x);
            assert.lengthOf(x, 2);
        });
github twosigma / git-meta / node / lib / util / synthetic_branch_util.js View on Github external
function* checkUpdate(repo, notesRepo, oldSha, newSha, handled) {
    assert.instanceOf(repo, NodeGit.Repository);
    assert.instanceOf(notesRepo, NodeGit.Repository);
    assert.isString(oldSha);
    assert.isString(newSha);
    assert.isObject(handled);

    // deleting is OK
    if (newSha === "0000000000000000000000000000000000000000") {
        return true;
    }

    const newAnnotated = yield GitUtil.resolveCommitish(repo, newSha);

    if (newAnnotated === null) {
        // No such commit exists, error
        return false;
    }

    const newCommit = yield repo.getCommit(newAnnotated.id());
github twosigma / git-meta / test / util / read_repo_ast_util.js View on Github external
const addSubmodule = co.wrap(function *(repo, url, path, sha) {
    assert.instanceOf(repo, NodeGit.Repository);
    assert.isString(url);
    assert.isString(path);
    assert.isString(sha);
    const submodule = yield NodeGit.Submodule.addSetup(repo, url, path, 1);
    const subRepo = yield submodule.open();
    const origin = yield subRepo.getRemote("origin");
    yield origin.connect(NodeGit.Enums.DIRECTION.FETCH,
                         new NodeGit.RemoteCallbacks(),
                         function () {});
    yield subRepo.fetch("origin", {});
    subRepo.setHeadDetached(sha);
    const commit = yield subRepo.getCommit(sha);
    yield NodeGit.Reset.reset(subRepo, commit, NodeGit.Reset.TYPE.HARD);
    yield submodule.addFinalize();
    return submodule;
});
github bionode / bionode-watermill / test / lifecycle.spec.js View on Github external
hashes: { it: 'should be an object with strings input, output, params ', fn: (val) => {
          assert.isOk(val.hasOwnProperty('input'))
          assert.isString(val['input'])
          assert.isOk(val.hasOwnProperty('output'))
          assert.isString(val['output'])
          assert.isOk(val.hasOwnProperty('params'))
          assert.isString(val['params'])
        } },
        name: { it: 'should be "Unnamed Task"', fn: (val) => assert.equal('Unnamed Task', val) },
github DefinitelyTyped / tsd / test / helper.ts View on Github external
export function assertFormatMD5(value:string, msg?:string):void {
		assert.isString(value, msg);
		assert.match(value, md5RegExp, msg);
	}
github twosigma / git-meta / node / lib / util / destitch_util.js View on Github external
exports.destitch = co.wrap(function *(repo,
                                      commitish,
                                      metaRemoteName,
                                      targetRefName) {
    assert.instanceOf(repo, NodeGit.Repository);
    assert.isString(commitish);
    assert.isString(metaRemoteName);
    if (null !== targetRefName) {
        assert.isString(targetRefName);
    }

    const annotated = yield GitUtil.resolveCommitish(repo, commitish);
    if (null === annotated) {
        throw new UserError(`\
Could not resolve '${commitish}' to a commit.`);
    }
    const commit = yield repo.getCommit(annotated.id());
    if (!(yield GitUtil.isValidRemoteName(repo, metaRemoteName))) {
        throw new UserError(`Invalid remote name: '${metaRemoteName}'.`);
    }
    const remote = yield NodeGit.Remote.lookup(repo, metaRemoteName);
    const baseUrl = remote.url();
github twosigma / git-meta / node / lib / util / git_util.js View on Github external
exports.readNote = co.wrap(function *(repo, notesRef, oid) {
    assert.instanceOf(repo, NodeGit.Repository);
    assert.isString(notesRef);
    assert(typeof(oid) === "string" || oid instanceof NodeGit.Oid);

    try {
        return yield NodeGit.Note.read(repo, notesRef, oid);
    }
    catch (e) {
        return null;
    }
});
github kartikayg / StatusPage / notification-service / src / lib / email.spec.js View on Github external
it ('should send the email with json transport', async function () {

    const r = await sendEmail('test', { email: 'kartikayg@gmail.com' }, { name: 'Kartik' }, undefined, {
      jsonTransport: true,
      logger: true
    });

    assert.isString(r.messageId);

  });
github twosigma / git-meta / node / lib / util / shorthand_parser_util.js View on Github external
exports.parseRepoShorthand = function (shorthand) {
    assert.isString(shorthand);

    shorthand = shorthand.trim();
    const rawResult = exports.parseRepoShorthandRaw(shorthand);
    assert.equal(0,
                 Object.keys(rawResult.openSubmodules),
                 "open submodules not supported in single-repo shorthand");
    const baseAST = getBaseRepo(rawResult.type, rawResult.typeData);
    assert.isNotNull(baseAST, `invalid base repo type ${rawResult.type}`);
    const resultArgs = prepareASTArguments(baseAST, rawResult);
    const fin = baseAST.copy(resultArgs);
    return fin;
};
github slackapi / node-slack-sdk / packages / web-api / src / WebClient.spec.js View on Github external
.then((parts) => {
            assert.lengthOf(parts.files, 1);
            const file = parts.files[0];
            assert.include(file, { fieldname: 'someBinaryField' });
            assert.isString(file.filename);
          });
      });