mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-11 14:07:09 +03:00
add genUser frameworks, start fixing tests
transformative: - getUserID - redisTest - reputation mocha test reconfig: - etag - getIP - userCounter - validateVideoIDs
This commit is contained in:
@@ -5,29 +5,23 @@ import { getHash } from "../../src/utils/getHash";
|
||||
import { client } from "../utils/httpClient";
|
||||
|
||||
describe("userCounter", () => {
|
||||
it("Should return 200", function (done) {
|
||||
it("Should return 200", function () {
|
||||
if (!config.userCounterURL) this.skip(); // skip if no userCounterURL is set
|
||||
axios.request({
|
||||
return 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));
|
||||
}).then(res => assert.strictEqual(res.status, 200));
|
||||
});
|
||||
it("Should not incremeent counter on OPTIONS", function (done) {
|
||||
it("Should not incremeent counter on OPTIONS", function () {
|
||||
/* cannot spy test */
|
||||
if (!config.userCounterURL) this.skip(); // skip if no userCounterURL is set
|
||||
//const spy = sinon.spy(UserCounter);
|
||||
client({ method: "OPTIONS", url: "/api/status" })
|
||||
return client({ method: "OPTIONS", url: "/api/status" })
|
||||
.then(() => client({ method: "GET", url: "/api/status" }));
|
||||
//assert.strictEqual(spy.callCount, 1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user