mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-14 15:37:07 +03:00
replace node-fetch with axios in src
This commit is contained in:
24
test/cases/userCounter.ts
Normal file
24
test/cases/userCounter.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import axios from "axios";
|
||||
import assert from "assert";
|
||||
import { config } from "../../src/config";
|
||||
import { getHash } from "../../src/utils/getHash";
|
||||
|
||||
|
||||
describe("userCounter", () => {
|
||||
it("Should return 200", (done) => {
|
||||
if (!config.userCounterURL) return done(); // skip if no userCounterURL is set
|
||||
axios.request({
|
||||
method: "POST",
|
||||
baseURL: config.userCounterURL,
|
||||
url: "/api/v1/addIP",
|
||||
params: {
|
||||
hashedIP: getHash("127.0.0.1",1)
|
||||
}
|
||||
})
|
||||
.then(res => {
|
||||
assert.strictEqual(res.status, 200);
|
||||
done();
|
||||
})
|
||||
.catch(err => done(err));
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user