forked from Laboratoria/CDMX009-MdLinks
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.spec.js
48 lines (40 loc) · 1.26 KB
/
test.spec.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
37
38
39
40
41
42
43
44
45
46
47
48
const fs = require('fs');
const expect = require('expect');
const { readFile, showLinks, isMarkDown, checkLinkStatus, arrayCount } = require('./app.js');
let path = './README.md'
let badPath = './app.js'
describe('readFile', () => {
it('Should Get all links of the file', () => {
expect(readFile()).toBe(undefined);
});
});
describe('readFile', () => {
it('Should be a function', () => {
expect(typeof readFile).toBe('function');
});
});
describe('isMarkDown', () => {
it('Should return false if it is not an .md file', () => {
expect(isMarkDown(badPath)).toBe(false);
});
});
describe('isMarkDown', () => {
it('Should return true if it is an .md file', () => {
expect(isMarkDown(path)).toBe(true);
});
});
describe('checkLinkStatus', () => {
it('Should retur err if links are not found in the file', () => {
expect(() => checkLinkStatus()).toThrow(Error);
});
});
describe('arrayCount', () => {
it('Should retur err if links are not found in the file', () => {
expect(() => arrayCount()).toThrow(Error);
});
});
describe('showLinks', () => {
it('Should return an array with the links that the file content ', () => {
expect(() => showLinks()).toThrow(Error);
});
});