UNPKG

@publidata/utils-socials

Version:

Collection of methods to handle social networks

48 lines (43 loc) 1.93 kB
const { expect } = require("chai"); const { getIframelyMetas } = require("./../src/socials"); describe("getIframelyMetas", () => { it("should return the correct metas for a youtube video", () => { const url = "https://www.youtube.com/watch?v=9bZkp7q19f0"; return getIframelyMetas(url).then(metas => { expect(metas).to.be.an("object"); expect(metas).to.have.property("type"); expect(metas.type).to.equal("video"); expect(metas).to.have.property("title"); expect(metas.title).to.equal("PSY - GANGNAM STYLE(강남스타일) M/V"); }); }); it("should return the correct metas for a vimeo video", () => { const url = "https://vimeo.com/1084537"; return getIframelyMetas(url).then(metas => { expect(metas).to.be.an("object"); expect(metas).to.have.property("type"); expect(metas.type).to.equal("video"); expect(metas).to.have.property("title"); expect(metas.title).to.equal("Big Buck Bunny"); }); }); it("should return the correct metas for a website", () => { const url = "https://www.paris.fr"; return getIframelyMetas(url).then(metas => { expect(metas).to.be.an("object"); expect(metas).to.have.property("type"); expect(metas.type).to.equal("rich"); expect(metas).to.have.property("title"); }) }); it("should return the correct metas for a twitter post", () => { const url = "https://twitter.com/jack/status/20"; return getIframelyMetas(url).then(metas => { expect(metas).to.be.an("object"); expect(metas).to.have.property("type"); expect(metas.type).to.equal("rich"); expect(metas).to.have.property("title"); expect(metas.title).to.equal("jack on Twitter"); }) }); });