當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript factories.createBasicTransaction函數代碼示例

本文整理匯總了TypeScript中mocks/transactions/factories.createBasicTransaction函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript createBasicTransaction函數的具體用法?TypeScript createBasicTransaction怎麽用?TypeScript createBasicTransaction使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了createBasicTransaction函數的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: describe

	describe("all", (): void => {
		const expectedResponse: TransactionBatch = {
			transactions: [createBasicTransaction(), createBasicTransaction()],
			openingBalance: 0,
			atEnd: false
		};
		let actualResponse: angular.IPromise<TransactionBatch>;

		beforeEach((): void => {
			const fromDate = new Date();

			transactionModel["parse"] = sinon.stub().returnsArg(0);
			$httpBackend.expectGET(new RegExp(`context/transactions\\?as_at=${fromDate.toISOString()}&direction=prev&unreconciled=true`)).respond(200, expectedResponse);
			actualResponse = transactionModel.all("context", fromDate, "prev", true);
			$httpBackend.flush();
		});

		it("should dispatch a GET request to /{context}/transactions?as_at={fromDate}&direction={direction}&unreconciled={unreconciledOnly}", (): null => null);

		it("should parse each transaction returned", (): Chai.Assertion => transactionModel["parse"].should.have.been.calledTwice);

		it("should return a list of transactions", (): void => {
			actualResponse.should.eventually.deep.equal(expectedResponse);
		});
	});
開發者ID:scottohara,項目名稱:loot,代碼行數:25,代碼來源:transaction.ts

示例2: beforeEach

	beforeEach(inject((_$sce_: angular.ISCEService, directiveTest: DirectiveTest, _transactionModel_: TransactionModelMock): void => {
		$sce = _$sce_;
		transactionStatus = directiveTest;
		transactionStatus.configure("transaction-status", "div");
		transactionStatus.scope.model = {account: createAccount({id: 123}), transaction: createBasicTransaction({id: 456})};
		transactionModel = _transactionModel_;
	}));
開發者ID:scottohara,項目名稱:loot,代碼行數:7,代碼來源:status.ts

示例3: beforeEach

		beforeEach((): void => {
			transactionModel["invalidateCaches"] = sinon.stub();
			transactionModel["stringify"] = sinon.stub().returnsArg(0);
			transactionModel["parse"] = sinon.stub().returnsArg(0);
			$httpBackend.whenPOST(/transactions$/).respond(200, expectedResponse);
			$httpBackend.whenPATCH(/transactions\/1$/).respond(200, expectedResponse);
			transaction = createBasicTransaction({id: 1});
		});
開發者ID:scottohara,項目名稱:loot,代碼行數:8,代碼來源:transaction.ts

示例4: createBasicTransaction

function *transactions(count: number): Iterable<BasicTransaction> {
	for (let id = 1, daysAgo = count + 1; id < count + 1; id++, daysAgo--) {
		yield createBasicTransaction({
			id,
			amount: id,
			direction: id % 2 ? "outflow" : "inflow",
			transaction_date: subDays(startOfDay(new Date()), daysAgo),
			status: id < 5 ? "Cleared" : ""
		});
	}
}
開發者ID:scottohara,項目名稱:loot,代碼行數:11,代碼來源:transactionbatch.ts

示例5: describe

	describe("findLastTransaction", (): void => {
		const expectedResponse: BasicTransaction = createBasicTransaction();
		let actualResponse: angular.IPromise<Transaction>;

		beforeEach((): void => {
			$httpBackend.expectGET(/securities\/1\/transactions\/last\?account_type=bank$/).respond(200, expectedResponse);
			actualResponse = securityModel.findLastTransaction(1, "bank");
			$httpBackend.flush();
		});

		it("should dispatch a GET request to /securities/{id}/transactions/last?account_type={accountType}", (): null => null);

		it("should return the last transaction for the security", (): void => {
			actualResponse.should.eventually.deep.equal(expectedResponse);
		});
	});
開發者ID:scottohara,項目名稱:loot,代碼行數:16,代碼來源:security.ts

示例6: it

		it("should dispatch a PUT request to /transactions/{id}/flag", (): void => {
			$httpBackend.expectPUT(/transactions\/1\/flag/, {memo: "flag"}).respond(200);
			transactionModel.flag(createBasicTransaction({id: 1, flag: "flag"}));
			$httpBackend.flush();
		});
開發者ID:scottohara,項目名稱:loot,代碼行數:5,代碼來源:transaction.ts


注:本文中的mocks/transactions/factories.createBasicTransaction函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。