From 7144bbed34ee3d867c76a88398e6d73843385b34 Mon Sep 17 00:00:00 2001 From: Luca Casonato Date: Sat, 7 Dec 2019 21:09:09 +0100 Subject: fix: plugin ops should change op count metrics (#3455) --- test_plugin/tests/test.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test_plugin/tests') diff --git a/test_plugin/tests/test.js b/test_plugin/tests/test.js index 5a127d328..cdbde4769 100644 --- a/test_plugin/tests/test.js +++ b/test_plugin/tests/test.js @@ -43,5 +43,24 @@ function runTestAsync() { } } +function runTestOpCount() { + const start = Deno.metrics(); + + testSync.dispatch(new Uint8Array([116, 101, 115, 116])); + + const end = Deno.metrics(); + + if (end.opsCompleted - start.opsCompleted !== 2) { + // one op for the plugin and one for Deno.metrics + throw new Error("The opsCompleted metric is not correct!"); + } + if (end.opsDispatched - start.opsDispatched !== 2) { + // one op for the plugin and one for Deno.metrics + throw new Error("The opsDispatched metric is not correct!"); + } +} + runTestSync(); runTestAsync(); + +runTestOpCount(); -- cgit v1.2.3