๐Ÿš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more โ†’
Socket
Sign inDemoInstall
Socket

assert-html

Package Overview
Dependencies
Maintainers
2
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assert-html

Assert two HTML strings are equal

1.1.5
latest
Source
npm
Version published
Weekly downloads
42
-44.74%
Maintainers
2
Weekly downloads
ย 
Created
Source

assert-html stability

npm version build status downloads js-standard-style

Assert two HTML strings are equal. Similar to spok but for HTML. Use assert-snapshot if you want an automated workflow.

Usage

var assertHtml = require('assert-html')
var tape = require('tape')
var html = require('bel')

tape('compare two DOM strings', function (assert) {
  var a, b
  a = html`<section>hello planet</section>`.toString()
  b = html`<section>hello world</section>`.toString()
  assertHtml(assert, a, b)

  a = html`<div><b>hello</b> planet</div>`.toString()
  b = html`<div><b>hello</b> planet</div>`.toString()
  assertHtml(assert, a, b)
  assert.end()
})

Outputs:

TAP version 13
# compare two DOM strings
ok 1 <section>
not ok 2 ยทยท hello world
  ---
    operator: equal
    expected: 'ยทยท hello world'
    actual:   'ยทยท hello planet'
    at: assertHtml (/Users/anon/src/shama/assert-html/index.js:59:13)
  ...
ok 3 </section>
ok 4 <div>
ok 5 ยทยท <b>
ok 6 ยทยท ยทยท hello
ok 7 ยทยท </b>
ok 8 ยทยท planet
ok 9 </div>

1..9
# tests 9
# pass  8
# fail  1

API

assertHtml(assert, actual, expected)

Assert two DOM strings are equal using a custom assert function. Calls assert.equal() method from the assert function.

See Also

License

MIT

Keywords

assert

FAQs

Package last updated on 30 Aug 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts