UNPKG

dev-to-git

Version:

A CLI to keep your dev.to posts in sync from a GIT project, using the CI provider of your choice

34 lines 1.85 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var article_1 = require("./article"); describe("Article", function () { var article; var repository = { username: "maxime1992", name: 'dev-to-git' }; var relativePathToArticle = "./test/article.md"; beforeEach(function () { article = new article_1.Article({ id: 0, relativePathToArticle: relativePathToArticle, repository: repository, }, 'private-dev-to-token'); }); describe("Read", function () { var articleRead; beforeEach(function () { articleRead = article.readArticleOnDisk(); }); it("should read an article from the configuration", function () { expect(articleRead).toContain("This is my awesome article!"); expect(articleRead).toContain("Hey, some text!"); }); it("should rewrite the local images URLs to match the raw file on github", function () { expect(articleRead).toContain("Image 1: ![alt text 1](https://raw.githubusercontent.com/" + repository.username + "/" + repository.name + "/master/test/image-1.png 'Title image 1')"); expect(articleRead).toContain("Image 2: ![alt text 2](https://raw.githubusercontent.com/" + repository.username + "/" + repository.name + "/master/test/image-2.png 'Title image 2')"); expect(articleRead).toContain("Image 3: ![alt text 3](https://raw.githubusercontent.com/" + repository.username + "/" + repository.name + "/master/test/image-3.png)"); }); it("should NOT rewrite absolute images URLs to match the raw file on github", function () { expect(articleRead).toContain("Absolute image: ![alt text](http://google.com/absolute-image.png)"); }); }); }); //# sourceMappingURL=article.spec.js.map