add tests
Gitnet/scraper/pipeline/head There was a failure building this commit
Details
Gitnet/scraper/pipeline/head There was a failure building this commit
Details
This commit is contained in:
parent
5619191a00
commit
62da111aca
|
@ -0,0 +1,13 @@
|
|||
pipeline {
|
||||
agent any
|
||||
|
||||
stages {
|
||||
stage('mocha') {
|
||||
steps {
|
||||
sh 'npm install --dev'
|
||||
sh 'npm run test'
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -3,7 +3,9 @@
|
|||
"description": "Web scraper using CSS selector",
|
||||
"version": "1.1.0",
|
||||
"main": "src/index.js",
|
||||
"devDependencies": {},
|
||||
"devDependencies": {
|
||||
"mocha": "^8.1.3"
|
||||
},
|
||||
"dependencies": {
|
||||
"cheerio": "^1.0.0-rc.3",
|
||||
"extends-classes": "^1.0.5",
|
||||
|
@ -14,7 +16,7 @@
|
|||
"trim": "^0.0.1"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
"test": "mocha"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
const filter = require('../src/filter/breaks')
|
||||
const assert = require('assert')
|
||||
|
||||
describe('Check "breaks"', () => {
|
||||
it('Should return empty string', () => {
|
||||
assert.equal(filter("\n"), "")
|
||||
})
|
||||
|
||||
it('Should return empty string', () => {
|
||||
assert.equal(filter("\r"), "")
|
||||
})
|
||||
|
||||
it('Should return "foo"', () => {
|
||||
assert.equal(filter("foo"), "foo")
|
||||
})
|
||||
|
||||
it('Should return "foobar"', () => {
|
||||
assert.equal(filter("\r\nfoo\nbar\r\n"), "foobar")
|
||||
})
|
||||
});
|
|
@ -0,0 +1,16 @@
|
|||
const filter = require('../src/filter/spaces')
|
||||
const assert = require('assert')
|
||||
|
||||
describe('Check "spaces"', () => {
|
||||
it('Should return ""', () => {
|
||||
assert.equal(filter(""), "")
|
||||
})
|
||||
|
||||
it('Should return "foo bar"', () => {
|
||||
assert.equal(filter("foo bar"), "foo bar")
|
||||
})
|
||||
|
||||
it('Should return "foo bar"', () => {
|
||||
assert.equal(filter("foo \nbar"), "foo bar")
|
||||
})
|
||||
});
|
|
@ -0,0 +1,5 @@
|
|||
const filter = require('../src/filter/tags')
|
||||
const assert = require('assert')
|
||||
|
||||
describe('Check "tags"', () => {
|
||||
});
|
|
@ -0,0 +1,20 @@
|
|||
const filter = require('../src/filter/trim')
|
||||
const assert = require('assert')
|
||||
|
||||
describe('Check "trim"', () => {
|
||||
it('Should return ""', () => {
|
||||
assert.equal(filter(""), "")
|
||||
})
|
||||
|
||||
it('Should return ""', () => {
|
||||
assert.equal(filter(" "), "")
|
||||
})
|
||||
|
||||
it('Should return "foo"', () => {
|
||||
assert.equal(filter(" foo "), "foo")
|
||||
})
|
||||
|
||||
it('Should return "foo bar"', () => {
|
||||
assert.equal(filter(" foo bar \n"), "foo bar")
|
||||
})
|
||||
});
|
Loading…
Reference in New Issue