Skip to content

Commit 6841aa3

Browse files
committed
extra clientstate tests
1 parent 7297601 commit 6841aa3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

Diff for: test/statenormalisation-tests.js

+33
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,36 @@ describe("Normalizing clientstate", () => {
7777
normalizer.normalized.should.deep.equal(resultdata);
7878
});
7979
});
80+
81+
describe("ClientState parsing", () => {
82+
it("Should work without executors", () => {
83+
const state = new clientstate.State({
84+
"sessions": [
85+
{"id":1,
86+
"language":"c++",
87+
"source":"int main() {}",
88+
"compilers":[{"id":"g91","options":"-O3 -std=c++2a"}]
89+
}]
90+
});
91+
92+
state.sessions[0].compilers.length.should.equal(1);
93+
state.sessions[0].executors.length.should.equal(0);
94+
});
95+
96+
it("Should work with executor", () => {
97+
const state = new clientstate.State({
98+
"sessions": [
99+
{"id":1,
100+
"language":"c++",
101+
"source":"int main() {}",
102+
"compilers": [],
103+
"executors":[{
104+
"compiler":{"id":"g91","options":"-O3 -std=c++2a"}
105+
}]
106+
}]
107+
});
108+
109+
state.sessions[0].compilers.length.should.equal(0);
110+
state.sessions[0].executors.length.should.equal(1);
111+
});
112+
});

0 commit comments

Comments
 (0)