我尝试解码base64编码的字符串令牌in react native,atob not work and library和js-base64这样的库无法解决问题.
有人有解决方案吗?
我是使用茉莉花进行角度测试的初学者,我需要测试数据类型(例如String,int等)
这是我的控制器,我的数据被实例化为null,之后它将是一个字符串:
_this.instance = {
template_fields: {
guid: null
}
}
// It becomes string
<input type="radio" ng-model="prCreateCtrl.instance.template_fields.guid" value="{{template.guid}}" required>
Run Code Online (Sandbox Code Playgroud)
这是我的测试:
beforeEach(inject(function ($state, $controller, $rootScope, $q) {
state = $state.get('app.provision');
ctrl = $controller('ProvisionCreateCtrl', {
instance: {
template_fields: {
guid : {}
}
}
});
}));
it('should resolve data', function () {
expect(ctrl.instance.template_fields.guid instanceof String).toBeTruthy();
});
Run Code Online (Sandbox Code Playgroud)
我不明白我什么时候应该给一个字符串,我该如何测试它.正确使用instanceof String吗?