-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
36 lines (26 loc) · 1.17 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
"use strict";
const {expect} = require("chai");
const {it} = require("mocha");
const linkTypes = require("./");
it("linkTypes()", () =>
{
const tagNofollow = ["tag","nofollow"];
expect( linkTypes("") ).to.deep.equal( [] );
expect( linkTypes("tag") ).to.deep.equal( ["tag"] );
expect( linkTypes("tag nofollow") ).to.deep.equal(tagNofollow);
expect( linkTypes(" tag nofollow ") ).to.deep.equal(tagNofollow);
expect( linkTypes("tag nofollow") ).to.deep.equal(tagNofollow);
expect( linkTypes("tag nofollow") ).to.deep.equal(tagNofollow);
expect( linkTypes("tag NOFOLLOW") ).to.deep.equal(tagNofollow);
});
it("linkTypes.map()", () =>
{
const tagNofollow = { tag:true, nofollow:true };
expect( linkTypes.map("") ).to.deep.equal( {} );
expect( linkTypes.map("tag") ).to.deep.equal( { tag:true } );
expect( linkTypes.map("tag nofollow") ).to.deep.equal(tagNofollow);
expect( linkTypes.map(" tag nofollow ") ).to.deep.equal(tagNofollow);
expect( linkTypes.map("tag nofollow") ).to.deep.equal(tagNofollow);
expect( linkTypes.map("tag nofollow") ).to.deep.equal(tagNofollow);
expect( linkTypes.map("tag NOFOLLOW") ).to.deep.equal(tagNofollow);
});