1
0
mirror of synced 2026-10-26 02:06:10 +08:00

🎨 完善 NFC 小程序 scheme 接口测试代码

This commit is contained in:
Binary Wang
2026-06-12 15:00:31 +08:00
committed by GitHub
parent 85f728d81d
commit 24d20b319e
4 changed files with 36 additions and 3 deletions

View File

@@ -66,7 +66,7 @@ public class WxMaEmployeeRelationServiceImplTest {
@Test
public void testUnbinduserb2cauthinfo() throws WxErrorException {
WxMaUnbindEmployeeRequest wxMaUnbindEmployeeRequest = new WxMaUnbindEmployeeRequest();
wxMaUnbindEmployeeRequest.setOpenidList(List.of("o0uBr12b1zdgCk1qDoBivmSYb9GA"));
wxMaUnbindEmployeeRequest.setOpenidList(Collections.singletonList("o0uBr12b1zdgCk1qDoBivmSYb9GA"));
this.wxService.getEmployeeRelationService().unbindEmployee(wxMaUnbindEmployeeRequest);
}

View File

@@ -0,0 +1,33 @@
package cn.binarywang.wx.miniapp.bean.scheme;
import me.chanjar.weixin.common.util.json.GsonParser;
import org.testng.annotations.Test;
import static org.assertj.core.api.Assertions.assertThat;
public class WxMaGenerateNfcSchemeRequestTest {
@Test
public void testToJson() {
WxMaGenerateNfcSchemeRequest request = WxMaGenerateNfcSchemeRequest.newBuilder()
.jumpWxa(WxMaGenerateNfcSchemeRequest.JumpWxa.newBuilder()
.path("pages/index/index")
.query("device=demo")
.envVersion("trial")
.build())
.modelId("model-demo")
.sn("sn-demo")
.build();
String expectedJson = "{\n"
+ " \"jump_wxa\": {\n"
+ " \"path\": \"pages/index/index\",\n"
+ " \"query\": \"device=demo\",\n"
+ " \"env_version\": \"trial\"\n"
+ " },\n"
+ " \"model_id\": \"model-demo\",\n"
+ " \"sn\": \"sn-demo\"\n"
+ "}";
assertThat(request.toJson()).isEqualTo(GsonParser.parse(expectedJson).toString());
}
}