extra clientstate tests

This commit is contained in:
Partouf
2019-09-21 04:46:55 +02:00
parent 7297601041
commit 6841aa3fea
+33
View File
@@ -77,3 +77,36 @@ describe("Normalizing clientstate", () => {
normalizer.normalized.should.deep.equal(resultdata);
});
});
describe("ClientState parsing", () => {
it("Should work without executors", () => {
const state = new clientstate.State({
"sessions": [
{"id":1,
"language":"c++",
"source":"int main() {}",
"compilers":[{"id":"g91","options":"-O3 -std=c++2a"}]
}]
});
state.sessions[0].compilers.length.should.equal(1);
state.sessions[0].executors.length.should.equal(0);
});
it("Should work with executor", () => {
const state = new clientstate.State({
"sessions": [
{"id":1,
"language":"c++",
"source":"int main() {}",
"compilers": [],
"executors":[{
"compiler":{"id":"g91","options":"-O3 -std=c++2a"}
}]
}]
});
state.sessions[0].compilers.length.should.equal(0);
state.sessions[0].executors.length.should.equal(1);
});
});