Skip to content

Commit

Permalink
add test for handling web stream
Browse files Browse the repository at this point in the history
  • Loading branch information
doxthree committed Feb 16, 2024
1 parent 9419604 commit ef54a6a
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions typescript/tests/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import ClientCredentialsGrantAuthenticator from "../src/ClientCredentialsGrantAuthenticator";
import ResourceOwnerPasswordGrantAuthenticator from "../src/ResourceOwnerPasswordGrantAuthenticator";
import { Readable } from "stream";
import axios from "axios";
import axios, { AxiosResponse } from "axios";

const chai = require("chai");
const chaiAsPromised = require("chai-as-promised");
Expand Down Expand Up @@ -205,7 +205,7 @@ describe("Test verdict requests", function () {
expect(verdict2.verdict).to.equal("Clean");
expect(verdict2.sha256.toUpperCase()).to.equal("3A78F382E8E2968EC201B33178102E06DB72E4F2D1505E058A4613C1E977825C");
});

https://www.virustotal.com/gui/file/edb6991d68ba5c7ed43f198c3d2593c770f2634beeb8c83afe3138279e5e81f3
xit("keeps connection alive", async () => {
const vaas = await createVaasWithClientCredentialsGrantAuthenticator();
const sha256 =
Expand Down Expand Up @@ -252,11 +252,18 @@ describe("Test verdict requests", function () {
const vaas = await createVaasWithClientCredentialsGrantAuthenticator();
const stream = new Readable();
stream._read = () => {};
stream.push("X5O!P%@AP[4\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*");
stream.push(`X5O!P%@AP[4\\PZX54(P^)7CC)7}$EICAR-STANDARD-ANTIVIRUS-TEST-FILE!$H+H*`);
stream.push(null);
const verdict = await vaas.forStream(stream);
expect(verdict.verdict).to.equal("Malicious");
});

it('if a EICAR stream from an url is submitted, a verdict "malicious" is expected', async () => {
const vaas = await createVaasWithClientCredentialsGrantAuthenticator();
const response = await axios.get<Readable>("https://secure.eicar.org/eicar.com.txt", { responseType: "stream" });
const verdict = await vaas.forStream(response.data);
expect(verdict.verdict).to.equal("Malicious");
});
});

describe("Vaas", async () => {
Expand Down

0 comments on commit ef54a6a

Please sign in to comment.