Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
it("does not have SpotIM comment tag when article comments are disabled", () => {
const articleWithCommentsDisabled = new MockArticle()
.sundayTimes()
.setCommentsEnabled(false)
.get();
cy.task("startMockServerWith", {
Article: articleWithCommentsDisabled,
User: userWithBookmarks
}).visit("/article/8763d1a0-ca57-11e8-bde6-fae32479843d");
cy.get("script[data-spotim-module]").should("not.exist");
});
it("has SpotIM comment tag when article comments are enabled", () => {
const articleWithCommentsEnabled = new MockArticle()
.sundayTimes()
.setCommentsEnabled(true)
.get();
cy.task("startMockServerWith", {
Article: articleWithCommentsEnabled,
User: userWithBookmarks
}).visit("/article/8763d1a0-ca57-11e8-bde6-fae32479843d");
cy.get("script[data-spotim-module]")
.should("have.attr", "src", "https://launcher.spot.im/spot/5p0t_1m_1d")
.should("have.attr", "data-post-id", articleWithCommentsEnabled.id)
.should(
"have.attr",
"data-post-url",
`https://www.thetimes.co.uk/article/${articleWithCommentsEnabled.id}`
before(() =>
cy.task("startMockServerWith", {
Article: new MockArticle().get(),
Author: new MockAuthor().setAuthorArticles(35).get()
})
);
before(() => {
cy.task("startMockServerWith", {
Article: new MockArticle().get(),
Topic: new MockTopic().setTopicArticles(25).get()
});
});