Update tests

This commit is contained in:
JeffreyCA 2020-08-10 14:25:00 -04:00
parent fc75efa9ad
commit 728b7930bc
4 changed files with 175 additions and 14 deletions

View file

@ -14,20 +14,20 @@ This README covers off:
Load up a Markdown file and get highlights and hovers for existing issues. Checking will occur as you type in the document.
![Underscores and hovers](https://github.com/username/repository/raw/master/images/SpellMDDemo1.gif)
![Underscores and hovers](https://github.com/username/repository/raw/main/images/SpellMDDemo1.gif)
The status bar lets you quickly navigate to any issue and you can see all positions in the gutter.
[![Jump to issues](https://github.com/username/repository/raw/master/images/SpellMDDemo2.gif)](http://shouldnottouchthis/)
[![Jump to issues](https://github.com/username/repository/raw/master/images/SpellMDDemo2.gif)](https://github.com/username/repository/blob/main/monkey)
![](https://github.com/username/repository/raw/master/images/SpellMDDemo2.gif)
<img src="https://github.com/username/repository/raw/master/images/myImage.gif">
[![Jump to issues](https://github.com/username/repository/raw/main/images/SpellMDDemo2.gif)](http://shouldnottouchthis/)
[![Jump to issues](https://github.com/username/repository/raw/main/images/SpellMDDemo2.gif)](https://github.com/username/repository/blob/main/monkey)
![](https://github.com/username/repository/raw/main/images/SpellMDDemo2.gif)
<img src="https://github.com/username/repository/raw/main/images/myImage.gif">
The `spellMD.json` config file is watched so you can add more ignores or change mappings at will.
![Add to dictionary](https://github.com/username/repository/raw/master/images/SpellMDDemo3.gif)
![Add to dictionary](https://github.com/username/repository/raw/main/images/SpellMDDemo3.gif)
![issue](https://github.com/username/repository/raw/master/issue)
![issue](https://github.com/username/repository/raw/main/issue)
[mono](https://github.com/username/repository/blob/main/monkey)
[not](http://shouldnottouchthis/)

View file

@ -0,0 +1,48 @@
# README
>**Important:** Once installed the checker will only update if you add the setting `"spellMD.enable": true` to your `.vscode\settings.json` file.
This README covers off:
* [Functionality](#functionality)
* [Install](#install)
* [Run and Configure](#run-and-configure)
* [Known Issues/Bugs](#known-issuesbugs)
* [Backlog](#backlog)
* [How to Debug](#how-to-debug)
# Functionality
Load up a Markdown file and get highlights and hovers for existing issues. Checking will occur as you type in the document.
![Underscores and hovers](https://github.com/base/images/SpellMDDemo1.gif)
The status bar lets you quickly navigate to any issue and you can see all positions in the gutter.
[![Jump to issues](https://github.com/base/images/SpellMDDemo2.gif)](http://shouldnottouchthis/)
[![Jump to issues](https://github.com/base/images/SpellMDDemo2.gif)](https://github.com/base/monkey)
![](https://github.com/base/images/SpellMDDemo2.gif)
<img src="https://github.com/base/images/myImage.gif">
The `spellMD.json` config file is watched so you can add more ignores or change mappings at will.
![Add to dictionary](https://github.com/base/images/SpellMDDemo3.gif)
![issue](https://github.com/base/issue)
[mono](https://github.com/base/monkey)
[not](http://shouldnottouchthis/)
[Email me](mailto:example@example.com)
# Install
This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
To clone the extension and load locally...
```
git clone https://github.com/Microsoft/vscode-SpellMD.git
npm install
tsc
```
>**Note:** TypeScript 1.6 or higher is required you can check with `tsc -v` and if you need to upgrade then run `npm install -g typescript`.

View file

@ -0,0 +1,48 @@
# README
>**Important:** Once installed the checker will only update if you add the setting `"spellMD.enable": true` to your `.vscode\settings.json` file.
This README covers off:
* [Functionality](#functionality)
* [Install](#install)
* [Run and Configure](#run-and-configure)
* [Known Issues/Bugs](#known-issuesbugs)
* [Backlog](#backlog)
* [How to Debug](#how-to-debug)
# Functionality
Load up a Markdown file and get highlights and hovers for existing issues. Checking will occur as you type in the document.
![Underscores and hovers](https://github.com/base/images/SpellMDDemo1.gif)
The status bar lets you quickly navigate to any issue and you can see all positions in the gutter.
[![Jump to issues](https://github.com/base/images/SpellMDDemo2.gif)](http://shouldnottouchthis/)
[![Jump to issues](https://github.com/base/images/SpellMDDemo2.gif)](https://github.com/username/repository/blob/main/monkey)
![](https://github.com/base/images/SpellMDDemo2.gif)
<img src="https://github.com/base/images/myImage.gif">
The `spellMD.json` config file is watched so you can add more ignores or change mappings at will.
![Add to dictionary](https://github.com/base/images/SpellMDDemo3.gif)
![issue](https://github.com/base/issue)
[mono](https://github.com/username/repository/blob/main/monkey)
[not](http://shouldnottouchthis/)
[Email me](mailto:example@example.com)
# Install
This extension is published in the VS Code Gallery. So simply hit 'F1' and type 'ext inst' from there select `SpellMD` and follow instructions.
To clone the extension and load locally...
```
git clone https://github.com/Microsoft/vscode-SpellMD.git
npm install
tsc
```
>**Note:** TypeScript 1.6 or higher is required you can check with `tsc -v` and if you need to upgrade then run `npm install -g typescript`.

View file

@ -1466,7 +1466,7 @@ describe('MarkdownProcessor', () => {
});
});
it('should respect specified GitHub branch and can be overriden', () => {
it('should replace relative links with GitHub URLs while respecting githubBranch', () => {
const manifest = {
name: 'test',
publisher: 'mocha',
@ -1478,9 +1478,7 @@ describe('MarkdownProcessor', () => {
const root = fixture('readme');
const processor = new ReadmeProcessor(manifest, {
githubBranch: 'main',
// Override image relative links to point to different base URL
baseImagesUrl: 'https://github.com/username/repository/raw/master'
githubBranch: 'main'
});
const readme = {
path: 'extension/readme.md',
@ -1490,13 +1488,80 @@ describe('MarkdownProcessor', () => {
return processor.onFile(readme)
.then(file => read(file))
.then(actual => {
return readFile(path.join(root, 'readme.branch.expected.md'), 'utf8')
return readFile(path.join(root, 'readme.branch.main.expected.md'), 'utf8')
.then(expected => {
assert.equal(actual, expected);
});
});
});
it("should override image URLs with baseImagesUrl while also respecting githubBranch", () => {
const manifest = {
name: "test",
publisher: "mocha",
version: "0.0.1",
description: "test extension",
engines: Object.create(null),
repository: "https://github.com/username/repository",
};
const root = fixture("readme");
const processor = new ReadmeProcessor(manifest, {
githubBranch: "main",
// Override image relative links to point to different base URL
baseImagesUrl: "https://github.com/base",
});
const readme = {
path: "extension/readme.md",
localPath: path.join(root, "readme.md"),
};
return processor
.onFile(readme)
.then((file) => read(file))
.then((actual) => {
return readFile(
path.join(root, "readme.branch.override.images.expected.md"),
"utf8"
).then((expected) => {
assert.equal(actual, expected);
});
});
});
it("should override githubBranch setting with baseContentUrl", () => {
const manifest = {
name: "test",
publisher: "mocha",
version: "0.0.1",
description: "test extension",
engines: Object.create(null),
repository: "https://github.com/username/repository",
};
const root = fixture("readme");
const processor = new ReadmeProcessor(manifest, {
githubBranch: "main",
baseContentUrl: "https://github.com/base",
});
const readme = {
path: "extension/readme.md",
localPath: path.join(root, "readme.md"),
};
return processor
.onFile(readme)
.then((file) => read(file))
.then((actual) => {
return readFile(
path.join(root, "readme.branch.override.content.expected.md"),
"utf8"
).then((expected) => {
assert.equal(actual, expected);
});
});
});
it('should infer baseContentUrl if its a github repo (.git)', () => {
const manifest = {
name: 'test',
@ -1520,8 +1585,8 @@ describe('MarkdownProcessor', () => {
return readFile(path.join(root, 'readme.expected.md'), 'utf8')
.then(expected => {
assert.equal(actual, expected);
});
});
});
});
});
it('should replace img urls with baseImagesUrl', () => {