这是一个有趣的问题:我正在尝试测试使用Ionic BarcodeScanner的服务.我有一个基于离子单元测试库的repo ,以便尝试测试.我正在嘲笑BarcodeScanner.scan方法spyOn(..).and.callFake(..)
问题:当我从组件调用扫描方法时,它可以工作.当我在服务中执行完全相同的操作时,它会抛出超时.
组件测试代码:
it("should be able to set a spy on the scanner and test the component", done => {
const testBC = "123456";
const spy = spyOn(TestBed.get(BarcodeScanner), "scan");
spy.and.callFake(() => {
return new Promise((resolve, reject) => {
resolve(testBC);
})
});
component.testScanner().then(res => {
expect(res).toBe(testBC);
done();
}, reason => {
expect(true).toBe(false);
done();
})
});
Run Code Online (Sandbox Code Playgroud)
服务测试代码:
it("should be able to set a spy on the scanner and test the service", done => {
const testBC = …Run Code Online (Sandbox Code Playgroud) 我目前正在开发一个cordova网络应用程序.
我想知道像Runkeeper这样的应用程序如何向我显示我的地址簿的联系人,这些联系人也在使用Runkeeper.每个联系人都有一个小电话符号,所以我猜这个链接是通过电话号码建立的.
Runkeeper从来没有得到我或我朋友的电话号码,但是SIM卡无法读取.
我能想到的唯一可能的方法是,Runkeeper从AccountManager读取我的其他帐户并使用我的WhatsApp-ID建立连接...
有人知道这是怎么回事吗?我可以在我的cordova应用程序中做到吗?
我正在尝试为我的测试生成一个karma.conf.js.
我的应用程序已经有大约30个标签引用我的代码.我正在以模块化结构编写我的AngularJS代码,就像这里推荐的那样.
我想知道如何不再将所有参考文献写入karma.conf.js ..有没有人知道这个的解决方案?
我查看了https://preview.npmjs.com/package/karma-loadscripts-preprocessor但它没有完成这项工作.似乎是从cdn-sources加载外部脚本.
在写我自己的shell脚本之前,我有点卡住了,这对我有用.
我有一个相对的文件夹'files / crm-upload',我想在其中上传文件。我的代码检查is_writable()是否为true,只有在这种情况下才继续进行。
该文件夹作为带有rw和sec = sys的NFS共享挂载。
我已经编写了一个测试脚本,我也在apache上执行了该脚本以查看访问权限,结果是:
files/crm-upload/php_touch modification time has been changed to present time
My effective UID is 33 but my UID is really 33
files/crm-upload/ is owned by 33 and has permissions 40777
is_readable('files/crm-upload/') gives true
is_readable('files/crm-upload/php_touch') gives true
is_writable('files/crm-upload/') gives false
is_writable('files/crm-upload/php_touch') gives true
is_writable('files/crm-upload/25/') gives true
is_writable('files/images/') gives true
file_exists('files/crm-upload/') gives true
file_exists('files/crm-upload/php_touch') gives true
Some stat uids:
files/crm-upload/: 33
files/crm-upload/php_touch: 33
files/images/: 33
Run Code Online (Sandbox Code Playgroud)
所以:
怎么可能只有已挂载共享的根文件夹不可写,而其他所有东西都不能写?
这是Ubuntu 18.04。客户端,没有运行SELinux ...
方法
Filter<T,U> connect(final Filter<T,U> filter) {
...
return filter
}
Run Code Online (Sandbox Code Playgroud)
在课堂上
class Pipe<T>
Run Code Online (Sandbox Code Playgroud)
我收到错误"无法解析U".我们的想法是在不知道U类型的情况下,通常返回具有相同两种类型的相同过滤器.我怎么做?
目标是能够在不提供类型参数的情况下进行链接,因为它们不会被修改:
(new Pipe<Integer>).connect(new Filter<>(...)).connect(new Pipe<>)...
Run Code Online (Sandbox Code Playgroud)
上述expamle中Filter之后的第二个Pipe应隐式为泛型类型Integer.