How to use the power-assert.ok function in power-assert

To help you get started, we’ve selected a few power-assert 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 reptar / reptar / test / unit / renderer / renderer.spec.js View on Github external
pluginManager.pluginApi.event.file.beforeRender(beforeSpy);
      pluginManager.pluginApi.event.file.afterRender(afterSpy);

      try {
        await instance.renderFileWithPlugins(
          file,
          {},
          PluginEvents.file.beforeRender,
          PluginEvents.file.afterRender
        );
      } catch (e) {
        // noop
      }

      assert.equal(beforeSpy.callCount, 1);
      assert.ok(beforeSpy.calledWith(file));

      assert.equal(file.render.callCount, 1);
      assert.ok(file.render.calledWith({}));

      assert.equal(afterSpy.callCount, 1);
      assert.ok(afterSpy.calledWith(file, renderContent));
    });
  });
github Automattic / mongoose / test / harmony / document.test_.js View on Github external
error = e;
      }

      assert.ok(!error);
      assert.equal(called, true);
      called = false;

      // The validator function above should now fail
      shouldSucceed = false;
      try {
        yield m.validate();
      } catch (e) {
        error = e;
      }

      assert.ok(error);
      assert.ok(error instanceof ValidationError);

      done();
    })();
  });
github googleapis / nodejs-firestore / test / collection.js View on Github external
it('has isEqual() method', function() {
    let coll1 = firestore.collection('coll1');
    let coll1Equals = firestore.collection('coll1');
    let coll2 = firestore.collection('coll2');
    assert.ok(coll1.isEqual(coll1Equals));
    assert.ok(!coll1.isEqual(coll2));
  });
});
github googleapis / nodejs-firestore / test / query.js View on Github external
it('has limit() method', function() {
    let query = firestore.collection('collectionId');
    assert.ok(query.limit);
  });
github googleapis / nodejs-firestore / test / document.js View on Github external
it('has isEqual() method', function() {
    let doc1 = firestore.doc('coll/doc1');
    let doc1Equals = firestore.doc('coll/doc1');
    let doc2 = firestore.doc('coll/doc1/coll/doc1');
    assert.ok(doc1.isEqual(doc1Equals));
    assert.ok(!doc1.isEqual(doc2));
  });
});
github kaorun343 / vue-youtube-embed / test / player.spec.js View on Github external
it('should call YT.Player.prototype.destroy()', () => {
      const component = {
        beforeDestroy: YouTubePlayer.beforeDestroy
      }
      const player = new container.YT.Player(null, null)
      component.player = player
      sinon.spy(player, 'destroy')
      component.beforeDestroy()
      assert.ok(player.destroy.called)
      assert.ok(typeof component.player === 'undefined')
    })
  })
github terinjokes / gulp-uglify / test / no-compress.js View on Github external
to.obj(function(newFile, enc, next) {
          assert.ok(newFile, 'emits a file');
          assert.ok(newFile.path, 'file has a path');
          assert.ok(newFile.relative, 'file has relative path information');
          assert.ok(newFile.contents, 'file has contents');

          assert.ok(newFile instanceof Vinyl, 'file is Vinyl');
          assert.ok(
            newFile.contents instanceof Buffer,
            'file contents are a buffer'
          );

          assert.equal(String(newFile.contents), testContentsExpected);
          next();
        })
      ],
github googleapis / nodejs-firestore / test / write-batch.js View on Github external
function verifyResponse(writeResults) {
    assert.ok(writeResults[0].writeTime.isEqual(new Firestore.Timestamp(0, 0)));
    assert.ok(writeResults[1].writeTime.isEqual(new Firestore.Timestamp(1, 1)));
    assert.ok(writeResults[2].writeTime.isEqual(new Firestore.Timestamp(2, 2)));
    assert.ok(writeResults[3].writeTime.isEqual(new Firestore.Timestamp(3, 3)));
  }
github googleapis / nodejs-firestore / test / query.js View on Github external
const queryEquals = (equals, notEquals) => {
      for (let i = 0; i < equals.length; ++i) {
        for (const equal of equals) {
          assert.ok(equals[i].isEqual(equal));
          assert.ok(equal.isEqual(equals[i]));
        }

        for (const notEqual of notEquals) {
          assert.ok(!equals[i].isEqual(notEqual));
          assert.ok(!notEqual.isEqual(equals[i]));
        }
      }
    };
github terinjokes / gulp-uglify / test / injectable.js View on Github external
to.obj(function(newFile, enc, next) {
          assert.ok(newFile, 'emits a file');
          assert.ok(newFile.path, 'file has a path');
          assert.ok(newFile.relative, 'file has relative path information');
          assert.ok(newFile.contents, 'file has contents');

          assert.ok(newFile instanceof Vinyl, 'file is Vinyl');
          assert.ok(
            newFile.contents instanceof Buffer,
            'file contents are a buffer'
          );

          assert.equal(String(newFile.contents), testContentsOutput);
          next();
        })
      ],