uniswap-v2-loader 5.0.17 → 5.0.18
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/test-cache.js +0 -111
package/package.json
CHANGED
package/test-cache.js
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
const fs = require('fs')
|
|
2
|
-
const { describe, before, after, it } = require('node:test')
|
|
3
|
-
const assert = require('node:assert/strict')
|
|
4
|
-
const {load, subscribe} = require('./index')
|
|
5
|
-
const default_cache_filename = require('./default_cache_filename')
|
|
6
|
-
const uniswap_v2_factory = '0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f'
|
|
7
|
-
|
|
8
|
-
describe('Cache OS filename at win32', () => {
|
|
9
|
-
const platform = process.platform
|
|
10
|
-
const os = require('os')
|
|
11
|
-
const path = require('path')
|
|
12
|
-
|
|
13
|
-
before(() => {
|
|
14
|
-
process.env.GITHUB_ACTIONS = ''
|
|
15
|
-
Object.defineProperty(process, 'platform', {value: 'win32', configurable: true})
|
|
16
|
-
})
|
|
17
|
-
|
|
18
|
-
it('win32', () => {
|
|
19
|
-
const expected = path.join(os.homedir(), 'AppData', 'Local', `uniswap-v2-loader_${uniswap_v2_factory}.csv`)
|
|
20
|
-
assert.equal(default_cache_filename(uniswap_v2_factory), expected)
|
|
21
|
-
})
|
|
22
|
-
it('win32 & APPDATA', () => {
|
|
23
|
-
process.env.APPDATA = 'cache'
|
|
24
|
-
assert.equal(
|
|
25
|
-
default_cache_filename(uniswap_v2_factory),
|
|
26
|
-
'cache/uniswap-v2-loader_0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f.csv'
|
|
27
|
-
)
|
|
28
|
-
})
|
|
29
|
-
it('win32 & LOCALAPPDATA', () => {
|
|
30
|
-
process.env.LOCALAPPDATA = 'cache'
|
|
31
|
-
assert.equal(
|
|
32
|
-
default_cache_filename(uniswap_v2_factory),
|
|
33
|
-
'cache/uniswap-v2-loader_0x5c69bee701ef814a2b6a3edd4b1652cb9cc5aa6f.csv'
|
|
34
|
-
)
|
|
35
|
-
})
|
|
36
|
-
|
|
37
|
-
it('linux .cache', () => {
|
|
38
|
-
const exists_sync = fs.existsSync
|
|
39
|
-
fs.existsSync = p => p.endsWith('.cache')
|
|
40
|
-
Object.defineProperty(process, 'platform', {value: 'linux', configurable: true})
|
|
41
|
-
process.env.XDG_CACHE_HOME = ''
|
|
42
|
-
const expected = path.join(os.homedir(), '.cache', `uniswap-v2-loader_${uniswap_v2_factory}.csv`)
|
|
43
|
-
assert.equal(default_cache_filename(uniswap_v2_factory), expected)
|
|
44
|
-
fs.existsSync = exists_sync
|
|
45
|
-
})
|
|
46
|
-
|
|
47
|
-
it('os.tmpdir()', () => {
|
|
48
|
-
const exists_sync = fs.existsSync
|
|
49
|
-
fs.existsSync = path => false
|
|
50
|
-
Object.defineProperty(process, 'platform', {value: 'linux', configurable: true})
|
|
51
|
-
process.env.XDG_CACHE_HOME = ''
|
|
52
|
-
|
|
53
|
-
const expected = path.join(os.tmpdir(), `uniswap-v2-loader_${uniswap_v2_factory}.csv`)
|
|
54
|
-
assert.equal(default_cache_filename(uniswap_v2_factory), expected)
|
|
55
|
-
fs.existsSync = exists_sync
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
after(() => {
|
|
59
|
-
process.env.GITHUB_ACTIONS = 1
|
|
60
|
-
Object.defineProperty(process, 'platform', {value: platform})
|
|
61
|
-
})
|
|
62
|
-
})
|
|
63
|
-
|
|
64
|
-
describe('Cache OS filename at darwin', () => {
|
|
65
|
-
const platform = process.platform
|
|
66
|
-
const os = require('os')
|
|
67
|
-
const path = require('path')
|
|
68
|
-
|
|
69
|
-
before(() => {
|
|
70
|
-
process.env.GITHUB_ACTIONS = ''
|
|
71
|
-
Object.defineProperty(process, 'platform', {value: 'darwin', configurable: true})
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
it('darwin', () => {
|
|
75
|
-
const expected = path.join(os.homedir(), 'Library', 'Caches', `uniswap-v2-loader_${uniswap_v2_factory}.csv`)
|
|
76
|
-
assert.equal(default_cache_filename(uniswap_v2_factory), expected)
|
|
77
|
-
})
|
|
78
|
-
|
|
79
|
-
after(() => {
|
|
80
|
-
process.env.GITHUB_ACTIONS = 1
|
|
81
|
-
Object.defineProperty(process, 'platform', {value: platform})
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
describe('Cache OS filename at linux', () => {
|
|
86
|
-
const platform = process.platform
|
|
87
|
-
const XDG_CACHE_HOME = process.env.XDG_CACHE_HOME
|
|
88
|
-
const os = require('os')
|
|
89
|
-
const path = require('path')
|
|
90
|
-
|
|
91
|
-
before(() => {
|
|
92
|
-
process.env.GITHUB_ACTIONS = ''
|
|
93
|
-
Object.defineProperty(process, 'platform', {value: 'linux', configurable: true})
|
|
94
|
-
})
|
|
95
|
-
|
|
96
|
-
it('linux XDG_CACHE_HOME', () => {
|
|
97
|
-
const exists_sync = fs.existsSync
|
|
98
|
-
const cache_dir = path.join(os.homedir(), '.cache')
|
|
99
|
-
fs.existsSync = p => p === cache_dir
|
|
100
|
-
process.env.XDG_CACHE_HOME = cache_dir
|
|
101
|
-
const expected = path.join(cache_dir, `uniswap-v2-loader_${uniswap_v2_factory}.csv`)
|
|
102
|
-
assert.equal(default_cache_filename(uniswap_v2_factory), expected)
|
|
103
|
-
fs.existsSync = exists_sync
|
|
104
|
-
})
|
|
105
|
-
|
|
106
|
-
after(() => {
|
|
107
|
-
process.env.GITHUB_ACTIONS = 1
|
|
108
|
-
process.env.XDG_CACHE_HOME = XDG_CACHE_HOME
|
|
109
|
-
Object.defineProperty(process, 'platform', {value: platform})
|
|
110
|
-
})
|
|
111
|
-
})
|