本文整理汇总了TypeScript中xhr-mock.setup函数的典型用法代码示例。如果您正苦于以下问题:TypeScript setup函数的具体用法?TypeScript setup怎么用?TypeScript setup使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setup函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: beforeEach
beforeEach(() => {
// Init SUSH
sush = new SUSH();
// Stubs
origSend = XMLHttpRequest.prototype.send;
xhrMock.setup();
});
开发者ID:3846masa,项目名称:SUSH,代码行数:7,代码来源:index.spec.ts
示例2: resetSpies
testNode2,
testNode3,
testNodeBase,
conflictNode1,
conflictNode2,
conflictComponent1,
conflictComponent2
} from "../Node/GomlParserTest_Registering";
import GomlLoader from "../../src/Node/GomlLoader";
import GrimoireInterface from "../../src/Interface/GrimoireInterface";
import fs from "../fileHelper";
const testcase1_goml = fs.readFile("../_TestResource/GomlNodeTest_Case1.goml");
const testcase1_html = fs.readFile("../_TestResource/GomlNodeTest_Case1.html");
xhrmock.setup();
xhrmock.get("./GomlNodeTest_Case1.goml", (req, res) => {
return res.status(200).body(testcase1_goml);
});
let stringConverterSpy,
testComponent1Spy,
testComponent2Spy,
testComponent3Spy,
testComponentBaseSpy,
testComponentOptionalSpy,
conflictComponent1Spy,
conflictComponent2Spy;
function resetSpies() {
stringConverterSpy.reset();
开发者ID:emadurandal,项目名称:GrimoireJS,代码行数:31,代码来源:NodeInterfaceTest.ts
示例3: mockSetup
public static mockSetup(): void {
xhrmock.setup();
}
开发者ID:emadurandal,项目名称:GrimoireJS,代码行数:3,代码来源:PageLoadingHelper.ts
示例4: beforeEach
beforeEach(() => mock.setup());
开发者ID:jameslnewell,项目名称:xhr-mock,代码行数:1,代码来源:rxjs.test.ts
示例5: describe
/// <reference path="../lib/mocha.d.ts" />
/// <reference path="../lib/chai.d.ts" />
/// <reference path="../lib/xhrmock.d.ts" />
import * as Ajax from '../src/ajax';
import {expect} from 'chai';
import * as Mock from 'xhr-mock';
Mock.setup();
describe("Ajax", () => {
describe("#send", () => {
it('should send a request', () => {
var req = new Ajax.Request('get', '/test');
// TODO write tests
req.send().then(response => console.log(response)).done();
});
});
describe('#camelizeKeys', () => {
it("camelize an object's keys", () => {
var object = {
$foo_bar: 4, bar_foo: [{ foo_bar: 10 }, 'jon_doe'],
nested_object: { nested_keys_are: 'converted' }
};
var result = '{"$fooBar":4,"barFoo":[{"fooBar":10},"jon_doe"],"nestedObject":{"nestedKeysAre":"converted"}}';
object = Ajax.camelizeKeys(object);
expect(JSON.stringify(object)).to.equal(result);
});
开发者ID:kuon,项目名称:ajax-utils,代码行数:31,代码来源:ajax.ts
注:本文中的xhr-mock.setup函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论