浏览代码

Add test for rawCodes with bad account names

Neeraj Gupta 1 年之前
父节点
当前提交
f05fb0374f
共有 1 个文件被更改,包括 10 次插入0 次删除
  1. 10 0
      test/models/code_test.dart

+ 10 - 0
test/models/code_test.dart

@@ -19,4 +19,14 @@ void main() {
     expect(code.account, "testdata@ente.io", reason: "accountMismatch");
     expect(code.secret, "ASKZNWOU6SVYAMVS");
   });
+//
+
+  test("parseWithFunnyAccountName", () {
+    final code = Code.fromRawData(
+      "otpauth://totp/Mongo Atlas:Acc !@#444?algorithm=sha1&digits=6&issuer=Mongo Atlas&period=30&secret=NI4CTTFEV4G2JFE6",
+    );
+    expect(code.issuer, "Mongo Atlas", reason: "issuerMismatch");
+    expect(code.account, "Acc !@#444", reason: "accountMismatch");
+    expect(code.secret, "NI4CTTFEV4G2JFE6");
+  });
 }