小编asc*_*oni的帖子

使用RequireJS,Jasmine和testr进行JavaScript依赖注入

我只是在使用RequireJS和Jasmine的单元测试策略中寻找依赖注入.我非常喜欢testr背后的想法,我试图按照github中的示例设置testr,但我无法弄清楚出了什么问题.我总是得到错误

错误:模块尚未加载:今天

当testr尝试加载要测试的模块时.

这里有一些背景..

index.html ..

<script data-main="config" src="../../assets/js/libs/require.js"></script>
<script src="vendor/testr.js"></script>
Run Code Online (Sandbox Code Playgroud)

config.js ..

require.config({

  // Initialize specs.
  deps:["main"],
...
...
});
Run Code Online (Sandbox Code Playgroud)

main.js ..

require([
  // Load the example spec, replace this and add your own spec
  "spec/today"
], function() {
  var jasmineEnv = jasmine.getEnv();
  jasmineEnv.execute();
});
Run Code Online (Sandbox Code Playgroud)

spec\today.js ..

describe('Today print', function() {
  var date = {}, today;
  beforeEach(function() {
     date.today = new Date(2012, 3, 30);
     today = testr('today', {'util/date': date});  //Here is where the error is thrown …
Run Code Online (Sandbox Code Playgroud)

unit-testing dependency-injection requirejs jasmine

8
推荐指数
1
解决办法
2005
查看次数

OrientDB如何在一个查询中获取顶点及其边的结果集

我一直在使用OrientDB sql查询来获取一个结果集,该结果集不仅包含顶点,还包含它们之间存在的内部边.

查询可以表示为:

  • 我想要所有与之相关的顶点project(没有项目本身)以及结果中包含的顶点之间的所有边

在此输入图像描述

这是我如何实现它,但我认为这不是正确的方法.

在此输入图像描述

select expand($union) let $vertices = ( select from ( traverse both() from (select from V where label = 'project') ) skip 1 ), $edges = ( select from ( select from E where @rid in ( select bothE() from ( select from ( traverse both() from (select from V where label = 'project') ) skip 1 ) ) ) where out in ( select from ( traverse both() from (select from V where …

sql graph-databases orientdb

5
推荐指数
1
解决办法
524
查看次数