@@ -13,10 +13,12 @@ import PingEncryptionPlugin from "../../src/plugins/encryption";
1313const sandbox = sinon . createSandbox ( ) ;
1414
1515describe ( "PingEncryptionPlugin" , function ( ) {
16+ // eslint-disable-next-line mocha/no-hooks-for-single-case
1617 beforeEach ( async function ( ) {
1718 await Glean . testResetGlean ( "something something" ) ;
1819 } ) ;
1920
21+ // eslint-disable-next-line mocha/no-hooks-for-single-case
2022 afterEach ( function ( ) {
2123 sandbox . restore ( ) ;
2224 } ) ;
@@ -26,25 +28,31 @@ describe("PingEncryptionPlugin", function() {
2628 sandbox . stub ( Glean [ "pingUploader" ] , "triggerUpload" ) . callsFake ( ( ) => Promise . resolve ( ) ) ;
2729
2830 await Glean . testUninitialize ( ) ;
31+ await Glean . testInitialize (
32+ "something something" ,
33+ true ,
34+ {
35+ plugins : [
36+ new PingEncryptionPlugin ( {
37+ "crv" : "P-256" ,
38+ "kid" : "test" ,
39+ "kty" : "EC" ,
40+ "x" : "Q20tsJdrryWJeuPXTM27wIPb_YbsdYPpkK2N9O6aXwM" ,
41+ "y" : "1onW1swaCcN1jkmkIwhXpCm55aMP8GRJln5E8WQKLJk"
42+ } )
43+ ]
44+ }
45+ ) ;
2946
30- const plugin = new PingEncryptionPlugin ( {
31- "kid" : "test" ,
32- "alg" : "ECDH-ES" ,
33- "crv" : "P-256" ,
34- "kty" : "EC" ,
35- "x" : "Qqihp7EryDN2-qQ-zuDPDpy5mJD5soFBDZmzPWTmjwk" ,
36- "y" : "PiEQVUlywi2bEsA3_5D0VFrCHClCyUlLW52ajYs-5uc"
37- } ) ;
38- await Glean . testInitialize ( "something something" , true , { plugins : [ plugin ] } ) ;
3947 const ping = new PingType ( {
4048 name : "ping" ,
4149 includeClientId : true ,
4250 sendIfEmpty : true ,
4351 } ) ;
44-
4552 await PingMaker . collectAndStorePing ( "ident" , ping ) ;
4653 const recordedPing = ( await Glean . pingsDatabase . getAllPings ( ) ) [ "ident" ] ;
47-
54+
4855 assert . ok ( "payload" in recordedPing . payload ) ;
56+ assert . strictEqual ( Object . keys ( recordedPing . payload ) . length , 1 ) ;
4957 } ) ;
5058} ) ;
0 commit comments