summaryrefslogtreecommitdiff
path: root/lambda-calcul/javascript/test/client.test.js
diff options
context:
space:
mode:
authorEmmanuel Gaillot <emmanuel.gaillot@gmail.com>2025-12-20 21:14:53 +0100
committerEmmanuel Gaillot <emmanuel.gaillot@gmail.com>2025-12-20 22:00:26 +0100
commit895e9a4fc2c1a427c55ebaafb5423d3db6e3dddc (patch)
treee69b67055428d49cc3bad8f81b1013e45a1dd5c8 /lambda-calcul/javascript/test/client.test.js
parent800f5628d86313c315d38e983318bb0a027137e2 (diff)
downloadlambda-nantes-895e9a4fc2c1a427c55ebaafb5423d3db6e3dddc.tar.gz
Solve retrieved challenge
Diffstat (limited to 'lambda-calcul/javascript/test/client.test.js')
-rw-r--r--lambda-calcul/javascript/test/client.test.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/lambda-calcul/javascript/test/client.test.js b/lambda-calcul/javascript/test/client.test.js
index 5fcc42c..8b68a61 100644
--- a/lambda-calcul/javascript/test/client.test.js
+++ b/lambda-calcul/javascript/test/client.test.js
@@ -54,4 +54,30 @@ describe('λ-calculator', () => {
return client.nextChallenge('SomeToken')
.then((challenge) => expect(challenge).toBe('SomeChallenge'));
});
+
+ it('solves challenges', () => {
+ const parser = {
+ parse: (challenge) => {
+ expect(challenge).toBe('Some challenge');
+ return 'Parsed expression';
+ },
+ };
+
+ const interpreter = {
+ evaluate: (parsedExpression) => {
+ expect(parsedExpression).toBe('Parsed expression');
+ return 'Evaluated expression';
+ },
+ };
+
+ const printer = {
+ print: (evaluatedExpression) => {
+ expect(evaluatedExpression).toBe('Evaluated expression');
+ return 'Expression to print';
+ },
+ };
+
+ const client = LC.newClient({ parser, interpreter, printer });
+ expect(client.solve('Some challenge')).toBe('Expression to print');
+ });
});