-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
33 lines (28 loc) · 860 Bytes
/
test.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
const path = require('path')
const fs = require('fs')
const https = require('https')
const assert = require('assert/strict')
const sourceUrl = 'https://unpkg.com/[email protected]/css/basscss.min.css'
const localFileName = '[email protected]'
const localPath = path.join(__dirname, localFileName)
const localBasscss = fs.readFileSync(localPath, { encoding: 'utf-8' })
https
.get(sourceUrl, res => {
let sourceBasscss = ''
res.on('data', chunk => {
sourceBasscss += chunk
})
res.on('end', () => {
try {
assert.strictEqual(localBasscss.trim(), sourceBasscss.trim())
console.log(
'✅ Test passed! The local [email protected] file is equal to the source [email protected] file.'
)
} catch (e) {
console.error(e.message)
}
})
})
.on('error', e => {
console.error(e)
})