зеркало из https://github.com/Azure/autorest.git
Switched Node.JS tests over to TypeScript. Essentially, they are the same tests as before except now strongly typed.
This commit is contained in:
Родитель
bbb6cf9101
Коммит
405a0438c1
|
@ -1,5 +1,6 @@
|
|||
## Ignore generated code
|
||||
AutoRest/NugetPackageTest/Generated
|
||||
AutoRest/Generators/NodeJS/NodeJS.Tests/AcceptanceTests/*.js
|
||||
|
||||
## Ignore user-specific files, temporary files, build results, etc.
|
||||
AutoRest/**/Templates/*.cs
|
||||
|
|
|
@ -3,35 +3,41 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var should = require('should');
|
||||
var http = require('http');
|
||||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
var msRest = require('ms-rest');
|
||||
var moment = require('moment');
|
||||
var fs = require('fs');
|
||||
import should = require('should');
|
||||
|
||||
import http = require('http');
|
||||
import util = require('util');
|
||||
import assert = require('assert');
|
||||
import msRest = require('ms-rest');
|
||||
import moment = require('moment');
|
||||
import fs = require('fs');
|
||||
|
||||
import stream = require('stream');
|
||||
|
||||
import boolClient = require('../Expected/AcceptanceTests/BodyBoolean/autoRestBoolTestService');
|
||||
import stringClient = require('../Expected/AcceptanceTests/BodyString/autoRestSwaggerBATService');
|
||||
import integerClient = require('../Expected/AcceptanceTests/BodyInteger/autoRestIntegerTestService');
|
||||
import numberClient = require('../Expected/AcceptanceTests/BodyNumber/autoRestNumberTestService');
|
||||
import byteClient = require('../Expected/AcceptanceTests/BodyByte/autoRestSwaggerBATByteService');
|
||||
import dateClient = require('../Expected/AcceptanceTests/BodyDate/autoRestDateTestService');
|
||||
import dateTimeClient = require('../Expected/AcceptanceTests/BodyDateTime/autoRestDateTimeTestService');
|
||||
import dateTimeRfc1123Client = require('../Expected/AcceptanceTests/BodyDateTimeRfc1123/autoRestRFC1123DateTimeTestService');
|
||||
import durationClient = require('../Expected/AcceptanceTests/BodyDuration/autoRestDurationTestService');
|
||||
import urlClient = require('../Expected/AcceptanceTests/Url/autoRestUrlTestService');
|
||||
import fileClient = require('../Expected/AcceptanceTests/BodyFile/autoRestSwaggerBATFileService');
|
||||
import arrayClient = require('../Expected/AcceptanceTests/BodyArray/autoRestSwaggerBATArrayService');
|
||||
import dictionaryClient = require('../Expected/AcceptanceTests/BodyDictionary/autoRestSwaggerBATdictionaryService');
|
||||
import dictionaryModels = require('../Expected/AcceptanceTests/BodyDictionary/models');
|
||||
import httpClient = require('../Expected/AcceptanceTests/Http/autoRestHttpInfrastructureTestService');
|
||||
|
||||
var boolClient = require('../Expected/AcceptanceTests/BodyBoolean/autoRestBoolTestService');
|
||||
var stringClient = require('../Expected/AcceptanceTests/BodyString/autoRestSwaggerBATService');
|
||||
var integerClient = require('../Expected/AcceptanceTests/BodyInteger/autoRestIntegerTestService');
|
||||
var numberClient = require('../Expected/AcceptanceTests/BodyNumber/autoRestNumberTestService');
|
||||
var byteClient = require('../Expected/AcceptanceTests/BodyByte/autoRestSwaggerBATByteService');
|
||||
var dateClient = require('../Expected/AcceptanceTests/BodyDate/autoRestDateTestService');
|
||||
var dateTimeClient = require('../Expected/AcceptanceTests/BodyDateTime/autoRestDateTimeTestService');
|
||||
var dateTimeRfc1123Client = require('../Expected/AcceptanceTests/BodyDateTimeRfc1123/autoRestRFC1123DateTimeTestService');
|
||||
var durationClient = require('../Expected/AcceptanceTests/BodyDuration/autoRestDurationTestService');
|
||||
var urlClient = require('../Expected/AcceptanceTests/Url/autoRestUrlTestService');
|
||||
var fileClient = require('../Expected/AcceptanceTests/BodyFile/autoRestSwaggerBATFileService');
|
||||
var arrayClient = require('../Expected/AcceptanceTests/BodyArray/autoRestSwaggerBATArrayService');
|
||||
var dictionaryClient = require('../Expected/AcceptanceTests/BodyDictionary/autoRestSwaggerBATdictionaryService');
|
||||
var httpClient = require('../Expected/AcceptanceTests/Http/autoRestHttpInfrastructureTestService');
|
||||
|
||||
var dummyToken = 'dummy12321343423';
|
||||
var credentials = new msRest.TokenCredentials(dummyToken);
|
||||
|
||||
var readStreamToBuffer = function(strm, callback) {
|
||||
var bufs = [];
|
||||
strm.on('data', function(d) {
|
||||
// TODO: Check types
|
||||
var readStreamToBuffer = function(strm: stream.Readable, callback: (err: Error, result: Buffer) => void) {
|
||||
var bufs: Buffer[] = [];
|
||||
strm.on('data', function(d: Buffer) {
|
||||
bufs.push(d);
|
||||
});
|
||||
strm.on('end', function () {
|
||||
|
@ -39,12 +45,12 @@ var readStreamToBuffer = function(strm, callback) {
|
|||
});
|
||||
};
|
||||
|
||||
var clientOptions = {};
|
||||
var clientOptions: msRest.ServiceClientOptions = {};
|
||||
var baseUri = 'http://localhost:3000';
|
||||
describe('nodejs', function () {
|
||||
|
||||
describe('Swagger BAT', function () {
|
||||
|
||||
|
||||
describe('Bool Client', function () {
|
||||
var testClient = new boolClient(baseUri, clientOptions);
|
||||
it('should get valid boolean values', function (done) {
|
||||
|
@ -361,10 +367,10 @@ describe('nodejs', function () {
|
|||
|
||||
it('should properly handle underflow and overflow date', function (done) {
|
||||
testClient.dateModel.getUnderflowDate(function (error, result) {
|
||||
isNaN(result).should.equal(true);
|
||||
isNaN(result.valueOf()).should.equal(true);
|
||||
should.not.exist(error);
|
||||
testClient.dateModel.getOverflowDate(function (error, result) {
|
||||
isNaN(result).should.equal(true);
|
||||
isNaN(result.valueOf()).should.equal(true);
|
||||
should.not.exist(error);
|
||||
done();
|
||||
});
|
||||
|
@ -381,7 +387,7 @@ describe('nodejs', function () {
|
|||
|
||||
it('should properly handle invalid Date value', function (done) {
|
||||
testClient.dateModel.getInvalidDate(function (error, result) {
|
||||
isNaN(result).should.equal(true);
|
||||
isNaN(result.valueOf()).should.equal(true);
|
||||
should.not.exist(error);
|
||||
done();
|
||||
});
|
||||
|
@ -412,7 +418,7 @@ describe('nodejs', function () {
|
|||
|
||||
it('should properly handle invalid dateTime value', function (done) {
|
||||
testClient.datetime.getInvalid(function (error, result) {
|
||||
isNaN(result).should.equal(true);
|
||||
isNaN(result.valueOf()).should.equal(true);
|
||||
should.not.exist(error);
|
||||
done();
|
||||
});
|
||||
|
@ -562,7 +568,7 @@ describe('nodejs', function () {
|
|||
date.getUTCSeconds().should.equal(59);
|
||||
date.getUTCMilliseconds().should.equal(999);
|
||||
testClient.datetime.getUnderflow(function (error, result) {
|
||||
isNaN(result).should.equal(true);
|
||||
isNaN(result.valueOf()).should.equal(true);
|
||||
should.not.exist(error);
|
||||
done();
|
||||
});
|
||||
|
@ -614,7 +620,7 @@ describe('nodejs', function () {
|
|||
|
||||
it('should properly handle invalid dateTimeRfc1123 value', function (done) {
|
||||
testClient.datetimerfc1123.getInvalid(function (error, result) {
|
||||
isNaN(result).should.equal(true);
|
||||
isNaN(result.valueOf()).should.equal(true);
|
||||
should.not.exist(error);
|
||||
done();
|
||||
});
|
||||
|
@ -680,7 +686,7 @@ describe('nodejs', function () {
|
|||
date.getUTCMinutes().should.equal(0);
|
||||
date.getUTCSeconds().should.equal(0);
|
||||
testClient.datetimerfc1123.getUnderflow(function (error, result) {
|
||||
isNaN(result).should.equal(true);
|
||||
isNaN(result.valueOf()).should.equal(true);
|
||||
should.not.exist(error);
|
||||
done();
|
||||
});
|
||||
|
@ -1078,7 +1084,8 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put valid dicitonary items in arrays', function (done) {
|
||||
var testArray = [{ '1': 'one', '2': 'two', '3': 'three' }, { '4': 'four', '5': 'five', '6': 'six' }, { '7': 'seven', '8': 'eight', '9': 'nine' }];
|
||||
var testArray: { [propertyName: string]: string }[] =
|
||||
[{ '1': 'one', '2': 'two', '3': 'three' }, { '4': 'four', '5': 'five', '6': 'six' }, { '7': 'seven', '8': 'eight', '9': 'nine' }];
|
||||
testClient.arrayModel.getDictionaryValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testArray);
|
||||
|
@ -1134,7 +1141,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put boolean dictionaries', function (done) {
|
||||
var boolDictionary = { "0": true, "1": false, "2": false, "3": true };
|
||||
var boolDictionary: { [propertyName: string]: boolean } = { "0": true, "1": false, "2": false, "3": true };
|
||||
testClient.dictionary.getBooleanTfft(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, boolDictionary);
|
||||
|
@ -1146,7 +1153,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get boolean dictionaries with null value', function (done) {
|
||||
var boolDictionary = { "0": true, "1": null, "2": false };
|
||||
var boolDictionary: { [propertyName: string]: boolean } = { "0": true, "1": null, "2": false };
|
||||
testClient.dictionary.getBooleanInvalidNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, boolDictionary);
|
||||
|
@ -1164,7 +1171,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put integer dictionaries', function (done) {
|
||||
var testDictionary = { "0": 1, "1": -1, "2": 3, "3": 300 };
|
||||
var testDictionary: { [propertyName: string]: number } = { "0": 1, "1": -1, "2": 3, "3": 300 };
|
||||
testClient.dictionary.getIntegerValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1176,7 +1183,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get integer dictionaries with null value', function (done) {
|
||||
var testDictionary = { "0": 1, "1": null, "2": 0 };
|
||||
var testDictionary: { [propertyName: string]: number } = { "0": 1, "1": null, "2": 0 };
|
||||
testClient.dictionary.getIntInvalidNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1194,7 +1201,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put long dictionaries', function (done) {
|
||||
var testDictionary = { "0": 1, "1": -1, "2": 3, "3": 300 };
|
||||
var testDictionary: { [propertyName: string]: number } = { "0": 1, "1": -1, "2": 3, "3": 300 };
|
||||
testClient.dictionary.getLongValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1206,7 +1213,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get long dictionaries with null value', function (done) {
|
||||
var testDictionary = { "0": 1, "1": null, "2": 0 };
|
||||
var testDictionary: { [propertyName: string]: number } = { "0": 1, "1": null, "2": 0 };
|
||||
testClient.dictionary.getLongInvalidNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1224,7 +1231,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put float dictionaries', function (done) {
|
||||
var testDictionary = { "0": 0, "1": -0.01, "2": -1.2e20 };
|
||||
var testDictionary: { [propertyName: string]: number } = { "0": 0, "1": -0.01, "2": -1.2e20 };
|
||||
testClient.dictionary.getFloatValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1236,7 +1243,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get float dictionaries with null value', function (done) {
|
||||
var testDictionary = { "0": 0.0, "1": null, "2": -1.2e20 };
|
||||
var testDictionary: { [propertyName: string]: number } = { "0": 0.0, "1": null, "2": -1.2e20 };
|
||||
testClient.dictionary.getFloatInvalidNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1254,7 +1261,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put double dictionaries', function (done) {
|
||||
var testDictionary = { "0": 0, "1": -0.01, "2": -1.2e20 };
|
||||
var testDictionary: { [propertyName: string]: number } = { "0": 0, "1": -0.01, "2": -1.2e20 };
|
||||
testClient.dictionary.getDoubleValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1266,7 +1273,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get double dictionaries with null value', function (done) {
|
||||
var testDictionary = { "0": 0.0, "1": null, "2": -1.2e20 };
|
||||
var testDictionary: { [propertyName: string]: number } = { "0": 0.0, "1": null, "2": -1.2e20 };
|
||||
testClient.dictionary.getDoubleInvalidNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1284,7 +1291,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put string dictionaries', function (done) {
|
||||
var testDictionary = { "0": "foo1", "1": "foo2", "2": "foo3" };
|
||||
var testDictionary: { [propertyName: string]: string } = { "0": "foo1", "1": "foo2", "2": "foo3" };
|
||||
testClient.dictionary.getStringValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1296,7 +1303,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get string dictionaries with null value', function (done) {
|
||||
var testDictionary = { "0": "foo", "1": null, "2": "foo2" };
|
||||
var testDictionary: { [propertyName: string]: string } = { "0": "foo", "1": null, "2": "foo2" };
|
||||
testClient.dictionary.getStringWithNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1314,7 +1321,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put date dictionaries', function (done) {
|
||||
var testDictionary = { 0: new Date('2000-12-01'), 1: new Date('1980-01-02'), 2: new Date('1492-10-12') };
|
||||
var testDictionary: { [propertyName: string]: Date } = { 0: new Date('2000-12-01'), 1: new Date('1980-01-02'), 2: new Date('1492-10-12') };
|
||||
testClient.dictionary.getDateValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1326,7 +1333,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get date dictionaries with null value', function (done) {
|
||||
var testDictionary = { "0": new Date("2012-01-01"), "1": null, "2": new Date("1776-07-04") };
|
||||
var testDictionary: { [propertyName: string]: Date } = { "0": new Date("2012-01-01"), "1": null, "2": new Date("1776-07-04") };
|
||||
testClient.dictionary.getDateInvalidNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1335,7 +1342,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get date dictionaries with string value', function (done) {
|
||||
var testDictionary = { "0": new Date("2011-03-22"), "1": new Date("date") };
|
||||
var testDictionary: { [propertyName: string]: Date } = { "0": new Date("2011-03-22"), "1": new Date("date") };
|
||||
testClient.dictionary.getDateInvalidChars(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(util.inspect(result), util.inspect(testDictionary));
|
||||
|
@ -1344,8 +1351,10 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put dateTime dictionaries', function (done) {
|
||||
var getDictionary = { 0: new Date('2000-12-01t00:00:01z'), 1: new Date('1980-01-02T00:11:35+01:00'), 2: new Date('1492-10-12T10:15:01-08:00') };
|
||||
var putDictionary = { 0: new Date('2000-12-01T00:00:01Z'), 1: new Date('1980-01-01T23:11:35Z'), 2: new Date('1492-10-12T18:15:01Z') };
|
||||
var getDictionary: { [propertyName: string]: Date } =
|
||||
{ 0: new Date('2000-12-01t00:00:01z'), 1: new Date('1980-01-02T00:11:35+01:00'), 2: new Date('1492-10-12T10:15:01-08:00') };
|
||||
var putDictionary: { [propertyName: string]: Date } =
|
||||
{ 0: new Date('2000-12-01T00:00:01Z'), 1: new Date('1980-01-01T23:11:35Z'), 2: new Date('1492-10-12T18:15:01Z') };
|
||||
testClient.dictionary.getDateTimeValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, getDictionary);
|
||||
|
@ -1357,7 +1366,8 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put dateTimeRfc1123 dictionaries', function (done) {
|
||||
var dictionary = { 0: new Date('Fri, 01 Dec 2000 00:00:01 GMT'), 1: new Date('Wed, 02 Jan 1980 00:11:35 GMT'), 2: new Date('Wed, 12 Oct 1492 10:15:01 GMT') };
|
||||
var dictionary: { [propertyName: string]: Date } =
|
||||
{ 0: new Date('Fri, 01 Dec 2000 00:00:01 GMT'), 1: new Date('Wed, 02 Jan 1980 00:11:35 GMT'), 2: new Date('Wed, 12 Oct 1492 10:15:01 GMT') };
|
||||
testClient.dictionary.getDateTimeRfc1123Valid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, dictionary);
|
||||
|
@ -1369,7 +1379,8 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put duration dictionaries', function (done) {
|
||||
var dictionary = { 0: moment.duration('P123DT22H14M12.011S'), 1: moment.duration('P5DT1H') };
|
||||
var dictionary: { [propertyName: string]: moment.Duration } =
|
||||
{ 0: moment.duration('P123DT22H14M12.011S'), 1: moment.duration('P5DT1H') };
|
||||
testClient.dictionary.getDurationValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, dictionary);
|
||||
|
@ -1381,7 +1392,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get dateTime dictionaries with null value', function (done) {
|
||||
var testDictionary = { "0": new Date("2000-12-01t00:00:01z"), "1": null };
|
||||
var testDictionary: { [propertyName: string]: Date } = { "0": new Date("2000-12-01t00:00:01z"), "1": null };
|
||||
testClient.dictionary.getDateTimeInvalidNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1390,7 +1401,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get dateTime dictionaries with string value', function (done) {
|
||||
var testDictionary = { "0": new Date("2000-12-01t00:00:01z"), "1": new Date("date-time") };
|
||||
var testDictionary: { [propertyName: string]: Date } = { "0": new Date("2000-12-01t00:00:01z"), "1": new Date("date-time") };
|
||||
testClient.dictionary.getDateTimeInvalidChars(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(util.inspect(result), util.inspect(testDictionary));
|
||||
|
@ -1402,7 +1413,7 @@ describe('nodejs', function () {
|
|||
var bytes1 = new Buffer([255, 255, 255, 250]);
|
||||
var bytes2 = new Buffer([1, 2, 3]);
|
||||
var bytes3 = new Buffer([37, 41, 67]);
|
||||
var testDictionary = { 0: bytes1, 1: bytes2, 2: bytes3 };
|
||||
var testDictionary: { [propertyName: string]: Buffer } = { 0: bytes1, 1: bytes2, 2: bytes3 };
|
||||
testClient.dictionary.getByteValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1414,7 +1425,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get byte dictionaries with null values', function (done) {
|
||||
var testDictionary = { 0: new Buffer([171, 172, 173]), 1: null };
|
||||
var testDictionary: { [propertyName: string]: Buffer } = { 0: new Buffer([171, 172, 173]), 1: null };
|
||||
testClient.dictionary.getByteInvalidNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
should.exist(result);
|
||||
|
@ -1439,7 +1450,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get complex items with empty and null values in dictionary', function (done) {
|
||||
var testNull = { 0: { 'integer': 1, 'string': '2' }, 1: null, 2: { 'integer': 5, 'string': '6' } };
|
||||
var testNull: { [propertyName: string]: dictionaryModels.Widget } = { 0: { 'integer': 1, 'string': '2' }, 1: null, 2: { 'integer': 5, 'string': '6' } };
|
||||
var testEmpty = { 0: { 'integer': 1, 'string': '2' }, 1: {}, 2: { 'integer': 5, 'string': '6' } };
|
||||
testClient.dictionary.getComplexItemNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
|
@ -1453,7 +1464,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put valid complex items in dictionaries', function (done) {
|
||||
var testDictionary = { 0: { 'integer': 1, 'string': '2' }, 1: { 'integer': 3, 'string': '4' }, 2: { 'integer': 5, 'string': '6' } };
|
||||
var testDictionary: { [propertyName: string]: dictionaryModels.Widget } = { 0: { 'integer': 1, 'string': '2' }, 1: { 'integer': 3, 'string': '4' }, 2: { 'integer': 5, 'string': '6' } };
|
||||
testClient.dictionary.getComplexValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1480,8 +1491,8 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get arrays with empty and null items in dictionary', function (done) {
|
||||
var testNull = { 0: ['1', '2', '3'], 1: null, 2: ['7', '8', '9'] };
|
||||
var testEmpty = { 0: ['1', '2', '3'], 1: [], 2: ['7', '8', '9'] };
|
||||
var testNull: { [propertyName: string]: string[] } = { 0: ['1', '2', '3'], 1: null, 2: ['7', '8', '9'] };
|
||||
var testEmpty: { [propertyName: string]: string[] } = { 0: ['1', '2', '3'], 1: [], 2: ['7', '8', '9'] };
|
||||
testClient.dictionary.getArrayItemNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testNull);
|
||||
|
@ -1494,7 +1505,7 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put valid array items in dictionary', function (done) {
|
||||
var testDictionary = { 0: ['1', '2', '3'], 1: ['4', '5', '6'], 2: ['7', '8', '9'] };
|
||||
var testDictionary: { [propertyName: string]: string[] } = { 0: ['1', '2', '3'], 1: ['4', '5', '6'], 2: ['7', '8', '9'] };
|
||||
testClient.dictionary.getArrayValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1521,8 +1532,10 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get dictionaries with empty and null items in dictionary', function (done) {
|
||||
var testNull = { 0: { '1': 'one', '2': 'two', '3': 'three' }, 1: null, 2: { '7': 'seven', '8': 'eight', '9': 'nine' } };
|
||||
var testEmpty = { 0: { '1': 'one', '2': 'two', '3': 'three' }, 1: {}, 2: { '7': 'seven', '8': 'eight', '9': 'nine' } };
|
||||
var testNull: { [propertyName: string]: { [propertyName: string]: string } } =
|
||||
{ 0: { '1': 'one', '2': 'two', '3': 'three' }, 1: null, 2: { '7': 'seven', '8': 'eight', '9': 'nine' } };
|
||||
var testEmpty: { [propertyName: string]: { [propertyName: string]: string } } =
|
||||
{ 0: { '1': 'one', '2': 'two', '3': 'three' }, 1: {}, 2: { '7': 'seven', '8': 'eight', '9': 'nine' } };
|
||||
testClient.dictionary.getDictionaryItemNull(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testNull);
|
||||
|
@ -1535,7 +1548,8 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
it('should get and put valid dicitonary items in dictionaries', function (done) {
|
||||
var testDictionary = { 0: { '1': 'one', '2': 'two', '3': 'three' }, 1: { '4': 'four', '5': 'five', '6': 'six' }, 2: { '7': 'seven', '8': 'eight', '9': 'nine' } };
|
||||
var testDictionary: { [propertyName: string]: { [propertyName: string]: string} } =
|
||||
{ 0: { '1': 'one', '2': 'two', '3': 'three' }, 1: { '4': 'four', '5': 'five', '6': 'six' }, 2: { '7': 'seven', '8': 'eight', '9': 'nine' } };
|
||||
testClient.dictionary.getDictionaryValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result, testDictionary);
|
||||
|
@ -1984,76 +1998,76 @@ describe('nodejs', function () {
|
|||
it('should work for all client failure status codes (4xx) with different verbs', function (done) {
|
||||
testClient.httpClientFailure.head400(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.httpClientFailure.get400(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.httpClientFailure.put400(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.httpClientFailure.patch400(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.httpClientFailure.post400(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.httpClientFailure.delete400(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.httpClientFailure.head401(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(401);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(401);
|
||||
testClient.httpClientFailure.get402(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(402);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(402);
|
||||
testClient.httpClientFailure.get403(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(403);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(403);
|
||||
testClient.httpClientFailure.put404(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(404);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(404);
|
||||
testClient.httpClientFailure.patch405(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(405);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(405);
|
||||
testClient.httpClientFailure.post406(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(406);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(406);
|
||||
testClient.httpClientFailure.delete407(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(407);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(407);
|
||||
testClient.httpClientFailure.put409(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(409);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(409);
|
||||
testClient.httpClientFailure.head410(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(410);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(410);
|
||||
testClient.httpClientFailure.get411(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(411);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(411);
|
||||
testClient.httpClientFailure.get412(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(412);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(412);
|
||||
testClient.httpClientFailure.put413(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(413);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(413);
|
||||
testClient.httpClientFailure.patch414(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(414);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(414);
|
||||
testClient.httpClientFailure.post415(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(415);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(415);
|
||||
testClient.httpClientFailure.get416(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(416);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(416);
|
||||
testClient.httpClientFailure.delete417(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(417);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(417);
|
||||
testClient.httpClientFailure.head429(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(429);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(429);
|
||||
testClient.httpFailure.getEmptyError(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
should.exist(error.message);
|
||||
// TODO, 4213049: Better default error message
|
||||
//error.message.should.match(/.*unexpected status code: 400.*/);
|
||||
|
@ -2087,16 +2101,16 @@ describe('nodejs', function () {
|
|||
it('should work for all server failure status codes (5xx) with different verbs', function (done) {
|
||||
testClient.httpServerFailure.head501(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(501);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(501);
|
||||
testClient.httpServerFailure.get501(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(501);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(501);
|
||||
testClient.httpServerFailure.post505(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(505);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(505);
|
||||
testClient.httpServerFailure.delete505(true, function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(505);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(505);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
@ -2147,10 +2161,10 @@ describe('nodejs', function () {
|
|||
//should use models.Error to deserialize and set it as body of javascript Error object
|
||||
testClient.multipleResponses.get200Model204NoModelDefaultError201Invalid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(201);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(201);
|
||||
testClient.multipleResponses.get200Model204NoModelDefaultError202None(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(202);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(202);
|
||||
//should we set body property of msRest.HttpOperationResponse to {}.
|
||||
//C3 does this Assert.Null(client.MultipleResponses.Get200Model204NoModelDefaultError204Valid());
|
||||
testClient.multipleResponses.get200Model204NoModelDefaultError204Valid(function (error, result) {
|
||||
|
@ -2159,7 +2173,7 @@ describe('nodejs', function () {
|
|||
//{"message":"client error","status":400} shouldn't we set this to error model defined in swagger?
|
||||
testClient.multipleResponses.get200Model204NoModelDefaultError400Valid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get200Model201ModelDefaultError200Valid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
result.statusCode.should.equal("200");
|
||||
|
@ -2169,7 +2183,7 @@ describe('nodejs', function () {
|
|||
assert.deepEqual(result, { 'statusCode': '201', 'textStatusCode': 'Created' });
|
||||
testClient.multipleResponses.get200Model201ModelDefaultError400Valid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get200ModelA201ModelC404ModelDDefaultError200Valid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
should.exist(result);
|
||||
|
@ -2184,24 +2198,24 @@ describe('nodejs', function () {
|
|||
result.httpStatusCode.should.equal("404");
|
||||
testClient.multipleResponses.get200ModelA201ModelC404ModelDDefaultError400Valid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get202None204NoneDefaultError202None(function (error, result) {
|
||||
should.not.exist(error);
|
||||
testClient.multipleResponses.get202None204NoneDefaultError204None(function (error, result) {
|
||||
should.not.exist(error);
|
||||
testClient.multipleResponses.get202None204NoneDefaultError400Valid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get202None204NoneDefaultNone202Invalid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
testClient.multipleResponses.get202None204NoneDefaultNone204None(function (error, result) {
|
||||
should.not.exist(error);
|
||||
testClient.multipleResponses.get202None204NoneDefaultNone400None(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get202None204NoneDefaultNone400Invalid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.getDefaultModelA200Valid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
//result.statusCode.should.equal("200");
|
||||
|
@ -2209,20 +2223,20 @@ describe('nodejs', function () {
|
|||
should.not.exist(error);
|
||||
testClient.multipleResponses.getDefaultModelA400Valid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.getDefaultModelA400None(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.getDefaultNone200Invalid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
testClient.multipleResponses.getDefaultNone200None(function (error, result) {
|
||||
should.not.exist(error);
|
||||
testClient.multipleResponses.getDefaultNone400Invalid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.getDefaultNone400None(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get200ModelA200None(function (error, result) {
|
||||
should.not.exist(error);
|
||||
testClient.multipleResponses.get200ModelA200Valid(function (error, result) {
|
||||
|
@ -2232,16 +2246,16 @@ describe('nodejs', function () {
|
|||
should.not.exist(error);
|
||||
testClient.multipleResponses.get200ModelA400None(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get200ModelA400Valid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get200ModelA400Invalid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(400);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(400);
|
||||
testClient.multipleResponses.get200ModelA202Valid(function (error, result) {
|
||||
should.exist(error);
|
||||
error.statusCode.should.equal(202);
|
||||
(<msRest.ServiceError> error).statusCode.should.equal(202);
|
||||
done();
|
||||
});
|
||||
});
|
|
@ -7,9 +7,10 @@ var should = require('should');
|
|||
var http = require('http');
|
||||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
var msRest = require('ms-rest');
|
||||
var moment = require('moment');
|
||||
var complexClient = require('../Expected/AcceptanceTests/BodyComplex/autoRestComplexTestService');
|
||||
import msRest = require('ms-rest');
|
||||
import moment = require('moment');
|
||||
import complexClient = require('../Expected/AcceptanceTests/BodyComplex/autoRestComplexTestService');
|
||||
import complexClientModels = require('../Expected/AcceptanceTests/BodyComplex/models');
|
||||
|
||||
var dummyToken = 'dummy12321343423';
|
||||
var credentials = new msRest.TokenCredentials(dummyToken);
|
||||
|
@ -254,7 +255,8 @@ describe('nodejs', function () {
|
|||
describe('Dictionary Types Operations', function () {
|
||||
var testClient = new complexClient(baseUri, clientOptions);
|
||||
it('should get and put valid dictionary type properties', function (done) {
|
||||
var testDictionary = { 'txt': 'notepad', 'bmp': 'mspaint', 'xls': 'excel', 'exe': '', '': null };
|
||||
var testDictionary: { [propertyName: string]: string } =
|
||||
{ 'txt': 'notepad', 'bmp': 'mspaint', 'xls': 'excel', 'exe': '', '': null };
|
||||
testClient.dictionary.getValid(function (error, result) {
|
||||
should.not.exist(error);
|
||||
assert.deepEqual(result.defaultProgram, testDictionary);
|
||||
|
@ -382,35 +384,35 @@ describe('nodejs', function () {
|
|||
});
|
||||
|
||||
describe('Complex Types with recursive definitions', function () {
|
||||
var bigfish = {
|
||||
var bigfish = <complexClientModels.Fish> {
|
||||
'dtype': 'salmon',
|
||||
'location': 'alaska',
|
||||
'iswild': true,
|
||||
'species': 'king',
|
||||
'length': 1,
|
||||
'siblings': [
|
||||
{
|
||||
<complexClientModels.Shark> {
|
||||
'dtype': 'shark',
|
||||
'age': 6,
|
||||
'birthday': new Date('2012-01-05T01:00:00Z'),
|
||||
'species': 'predator',
|
||||
'length': 20,
|
||||
'siblings': [
|
||||
{
|
||||
<complexClientModels.Salmon> {
|
||||
'dtype': 'salmon',
|
||||
'location': 'atlantic',
|
||||
'iswild': true,
|
||||
'species': 'coho',
|
||||
'length': 2,
|
||||
'siblings': [
|
||||
{
|
||||
<complexClientModels.Shark> {
|
||||
'dtype': 'shark',
|
||||
'age': 6,
|
||||
'birthday': new Date('2012-01-05T01:00:00Z'),
|
||||
'species': 'predator',
|
||||
'length': 20
|
||||
},
|
||||
{
|
||||
<complexClientModels.Sawshark> {
|
||||
'dtype': 'sawshark',
|
||||
'age': 105,
|
||||
'birthday': new Date('1900-01-05T01:00:00Z'),
|
||||
|
@ -420,7 +422,7 @@ describe('nodejs', function () {
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
<complexClientModels.Sawshark> {
|
||||
'dtype': 'sawshark',
|
||||
'age': 105,
|
||||
'birthday': new Date('1900-01-05T01:00:00Z'),
|
||||
|
@ -431,7 +433,7 @@ describe('nodejs', function () {
|
|||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
<complexClientModels.Sawshark> {
|
||||
'dtype': 'sawshark',
|
||||
'age': 105,
|
||||
'birthday': new Date('1900-01-05T01:00:00Z'),
|
|
@ -3,14 +3,14 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var should = require('should');
|
||||
var http = require('http');
|
||||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
var msRest = require('ms-rest');
|
||||
import should = require('should');
|
||||
import http = require('http');
|
||||
import util = require('util');
|
||||
import assert = require('assert');
|
||||
import msRest = require('ms-rest');
|
||||
var _ = require('underscore')
|
||||
|
||||
var reportClient = require('../Expected/AcceptanceTests/Report/autoRestReportService');
|
||||
import reportClient = require('../Expected/AcceptanceTests/Report/autoRestReportService');
|
||||
|
||||
var dummyToken = 'dummy12321343423';
|
||||
var credentials = new msRest.TokenCredentials(dummyToken);
|
||||
|
@ -37,7 +37,7 @@ describe('nodejs', function () {
|
|||
|
||||
var total = _.keys(result).length;
|
||||
var passed = 0;
|
||||
_.keys(result).forEach(function(item) {
|
||||
_.keys(result).forEach(function(item: string) {
|
||||
if (result[item] > 0) {
|
||||
passed++;
|
||||
} else {
|
|
@ -3,15 +3,15 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var should = require('should');
|
||||
var http = require('http');
|
||||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
var msRest = require('ms-rest');
|
||||
var moment = require('moment');
|
||||
import should = require('should');
|
||||
import http = require('http');
|
||||
import util = require('util');
|
||||
import assert = require('assert');
|
||||
import msRest = require('ms-rest');
|
||||
import moment = require('moment');
|
||||
var _ = require('underscore')
|
||||
|
||||
var headerClient = require('../Expected/AcceptanceTests/Header/autoRestSwaggerBATHeaderService');
|
||||
import headerClient = require('../Expected/AcceptanceTests/Header/autoRestSwaggerBATHeaderService');
|
||||
|
||||
var dummyToken = 'dummy12321343423';
|
||||
var credentials = new msRest.TokenCredentials(dummyToken);
|
|
@ -3,13 +3,13 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
var should = require('should');
|
||||
var http = require('http');
|
||||
var util = require('util');
|
||||
var assert = require('assert');
|
||||
var msRest = require('ms-rest');
|
||||
import should = require('should');
|
||||
import http = require('http');
|
||||
import util = require('util');
|
||||
import assert = require('assert');
|
||||
import msRest = require('ms-rest');
|
||||
|
||||
var reqOptClient = require('../Expected/AcceptanceTests/RequiredOptional/autoRestRequiredOptionalTestService');
|
||||
import reqOptClient = require('../Expected/AcceptanceTests/RequiredOptional/autoRestRequiredOptionalTestService');
|
||||
|
||||
var dummyToken = 'dummy12321343423';
|
||||
var credentials = new msRest.TokenCredentials(dummyToken);
|
|
@ -3,9 +3,10 @@
|
|||
|
||||
var util = require('util');
|
||||
var fs = require('fs');
|
||||
var child_process = require('child_process');
|
||||
|
||||
var child;
|
||||
import child_process = require('child_process');
|
||||
|
||||
var child: child_process.ChildProcess;
|
||||
|
||||
before(function (done) {
|
||||
var isWin = /^win/.test(process.platform);
|
||||
|
@ -18,7 +19,7 @@ before(function (done) {
|
|||
fs.writeSync(out, 'Test run started at ' + new Date().toISOString() + '\n');
|
||||
child = child_process.spawn(nodeCmd, [__dirname + '/../../../../TestServer/server/startup/www']);
|
||||
|
||||
child.stdout.on('data', function (data) {
|
||||
child.stdout.on('data', function (data: Buffer) {
|
||||
fs.writeSync(out, data.toString('UTF-8'));
|
||||
if (data.toString().indexOf('started') > 0) {
|
||||
started = true;
|
||||
|
@ -26,7 +27,7 @@ before(function (done) {
|
|||
}
|
||||
});
|
||||
|
||||
child.on('close', function (code) {
|
||||
child.on('close', function () {
|
||||
if (!started) {
|
||||
done();
|
||||
}
|
|
@ -25,9 +25,10 @@
|
|||
"moment": "2.10.6",
|
||||
"should": "5.2.0",
|
||||
"underscore": "*"
|
||||
|
||||
},
|
||||
"devDependencies": {
|
||||
"tslint": "^2.5.1",
|
||||
"typescript": "^1.6.2"
|
||||
},
|
||||
"homepage": "https://github.com/Azure/AutoRest",
|
||||
"repository": {
|
||||
|
@ -39,7 +40,8 @@
|
|||
},
|
||||
"scripts": {
|
||||
"pretest": "npm install --prefix ../../../TestServer/server && npm install",
|
||||
"test": "npm -s run-script jshint && npm -s run-script unit",
|
||||
"build": "tsc",
|
||||
"test": "npm -s run-script build && npm -s run-script unit",
|
||||
"unit": "node unit.js testlist.txt list",
|
||||
"xunit": "node unit.js testlist.txt",
|
||||
"jshint": "jshint Expected --reporter=jslint"
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"compilerOptions": {
|
||||
"module": "commonjs",
|
||||
"noImplicitAny": true
|
||||
},
|
||||
"exclude": [
|
||||
"node_modules/typescript",
|
||||
"node_modules/tslint"
|
||||
]
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
{
|
||||
"version": "v4",
|
||||
"repo": "borisyankov/DefinitelyTyped",
|
||||
"ref": "master",
|
||||
"path": "typings",
|
||||
"bundle": "typings/tsd.d.ts",
|
||||
"installed": {
|
||||
"mocha/mocha.d.ts": {
|
||||
"commit": "e9be3cecf8a326d3e220c52b42d218169a7bb9f2"
|
||||
},
|
||||
"node/node.d.ts": {
|
||||
"commit": "98a9440752f3f2ad7786aba1bf9bdefec818919e"
|
||||
},
|
||||
"should/should.d.ts": {
|
||||
"commit": "98a9440752f3f2ad7786aba1bf9bdefec818919e"
|
||||
},
|
||||
"moment/moment.d.ts": {
|
||||
"commit": "98a9440752f3f2ad7786aba1bf9bdefec818919e"
|
||||
},
|
||||
"moment/moment-node.d.ts": {
|
||||
"commit": "98a9440752f3f2ad7786aba1bf9bdefec818919e"
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,214 @@
|
|||
// Type definitions for mocha 2.2.5
|
||||
// Project: http://mochajs.org/
|
||||
// Definitions by: Kazi Manzur Rashid <https://github.com/kazimanzurrashid/>, otiai10 <https://github.com/otiai10>, jt000 <https://github.com/jt000>, Vadim Macagon <https://github.com/enlight>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface MochaSetupOptions {
|
||||
//milliseconds to wait before considering a test slow
|
||||
slow?: number;
|
||||
|
||||
// timeout in milliseconds
|
||||
timeout?: number;
|
||||
|
||||
// ui name "bdd", "tdd", "exports" etc
|
||||
ui?: string;
|
||||
|
||||
//array of accepted globals
|
||||
globals?: any[];
|
||||
|
||||
// reporter instance (function or string), defaults to `mocha.reporters.Spec`
|
||||
reporter?: any;
|
||||
|
||||
// bail on the first test failure
|
||||
bail?: boolean;
|
||||
|
||||
// ignore global leaks
|
||||
ignoreLeaks?: boolean;
|
||||
|
||||
// grep string or regexp to filter tests with
|
||||
grep?: any;
|
||||
}
|
||||
|
||||
interface MochaDone {
|
||||
(error?: Error): void;
|
||||
}
|
||||
|
||||
declare var mocha: Mocha;
|
||||
declare var describe: Mocha.IContextDefinition;
|
||||
declare var xdescribe: Mocha.IContextDefinition;
|
||||
// alias for `describe`
|
||||
declare var context: Mocha.IContextDefinition;
|
||||
// alias for `describe`
|
||||
declare var suite: Mocha.IContextDefinition;
|
||||
declare var it: Mocha.ITestDefinition;
|
||||
declare var xit: Mocha.ITestDefinition;
|
||||
// alias for `it`
|
||||
declare var test: Mocha.ITestDefinition;
|
||||
|
||||
declare function before(action: () => void): void;
|
||||
|
||||
declare function before(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function setup(action: () => void): void;
|
||||
|
||||
declare function setup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function after(action: () => void): void;
|
||||
|
||||
declare function after(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function teardown(action: () => void): void;
|
||||
|
||||
declare function teardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function beforeEach(action: () => void): void;
|
||||
|
||||
declare function beforeEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteSetup(action: () => void): void;
|
||||
|
||||
declare function suiteSetup(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function afterEach(action: () => void): void;
|
||||
|
||||
declare function afterEach(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare function suiteTeardown(action: () => void): void;
|
||||
|
||||
declare function suiteTeardown(action: (done: MochaDone) => void): void;
|
||||
|
||||
declare class Mocha {
|
||||
constructor(options?: {
|
||||
grep?: RegExp;
|
||||
ui?: string;
|
||||
reporter?: string;
|
||||
timeout?: number;
|
||||
bail?: boolean;
|
||||
});
|
||||
|
||||
/** Setup mocha with the given options. */
|
||||
setup(options: MochaSetupOptions): Mocha;
|
||||
bail(value?: boolean): Mocha;
|
||||
addFile(file: string): Mocha;
|
||||
/** Sets reporter by name, defaults to "spec". */
|
||||
reporter(name: string): Mocha;
|
||||
/** Sets reporter constructor, defaults to mocha.reporters.Spec. */
|
||||
reporter(reporter: (runner: Mocha.IRunner, options: any) => any): Mocha;
|
||||
ui(value: string): Mocha;
|
||||
grep(value: string): Mocha;
|
||||
grep(value: RegExp): Mocha;
|
||||
invert(): Mocha;
|
||||
ignoreLeaks(value: boolean): Mocha;
|
||||
checkLeaks(): Mocha;
|
||||
/** Enables growl support. */
|
||||
growl(): Mocha;
|
||||
globals(value: string): Mocha;
|
||||
globals(values: string[]): Mocha;
|
||||
useColors(value: boolean): Mocha;
|
||||
useInlineDiffs(value: boolean): Mocha;
|
||||
timeout(value: number): Mocha;
|
||||
slow(value: number): Mocha;
|
||||
enableTimeouts(value: boolean): Mocha;
|
||||
asyncOnly(value: boolean): Mocha;
|
||||
noHighlighting(value: boolean): Mocha;
|
||||
/** Runs tests and invokes `onComplete()` when finished. */
|
||||
run(onComplete?: (failures: number) => void): Mocha.IRunner;
|
||||
}
|
||||
|
||||
// merge the Mocha class declaration with a module
|
||||
declare module Mocha {
|
||||
/** Partial interface for Mocha's `Runnable` class. */
|
||||
interface IRunnable {
|
||||
title: string;
|
||||
fn: Function;
|
||||
async: boolean;
|
||||
sync: boolean;
|
||||
timedOut: boolean;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Suite` class. */
|
||||
interface ISuite {
|
||||
parent: ISuite;
|
||||
title: string;
|
||||
|
||||
fullTitle(): string;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Test` class. */
|
||||
interface ITest extends IRunnable {
|
||||
parent: ISuite;
|
||||
pending: boolean;
|
||||
|
||||
fullTitle(): string;
|
||||
}
|
||||
|
||||
/** Partial interface for Mocha's `Runner` class. */
|
||||
interface IRunner {}
|
||||
|
||||
interface IContextDefinition {
|
||||
(description: string, spec: () => void): ISuite;
|
||||
only(description: string, spec: () => void): ISuite;
|
||||
skip(description: string, spec: () => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
interface ITestDefinition {
|
||||
(expectation: string, assertion?: () => void): ITest;
|
||||
(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
only(expectation: string, assertion?: () => void): ITest;
|
||||
only(expectation: string, assertion?: (done: MochaDone) => void): ITest;
|
||||
skip(expectation: string, assertion?: () => void): void;
|
||||
skip(expectation: string, assertion?: (done: MochaDone) => void): void;
|
||||
timeout(ms: number): void;
|
||||
}
|
||||
|
||||
export module reporters {
|
||||
export class Base {
|
||||
stats: {
|
||||
suites: number;
|
||||
tests: number;
|
||||
passes: number;
|
||||
pending: number;
|
||||
failures: number;
|
||||
};
|
||||
|
||||
constructor(runner: IRunner);
|
||||
}
|
||||
|
||||
export class Doc extends Base {}
|
||||
export class Dot extends Base {}
|
||||
export class HTML extends Base {}
|
||||
export class HTMLCov extends Base {}
|
||||
export class JSON extends Base {}
|
||||
export class JSONCov extends Base {}
|
||||
export class JSONStream extends Base {}
|
||||
export class Landing extends Base {}
|
||||
export class List extends Base {}
|
||||
export class Markdown extends Base {}
|
||||
export class Min extends Base {}
|
||||
export class Nyan extends Base {}
|
||||
export class Progress extends Base {
|
||||
/**
|
||||
* @param options.open String used to indicate the start of the progress bar.
|
||||
* @param options.complete String used to indicate a complete test on the progress bar.
|
||||
* @param options.incomplete String used to indicate an incomplete test on the progress bar.
|
||||
* @param options.close String used to indicate the end of the progress bar.
|
||||
*/
|
||||
constructor(runner: IRunner, options?: {
|
||||
open?: string;
|
||||
complete?: string;
|
||||
incomplete?: string;
|
||||
close?: string;
|
||||
});
|
||||
}
|
||||
export class Spec extends Base {}
|
||||
export class TAP extends Base {}
|
||||
export class XUnit extends Base {
|
||||
constructor(runner: IRunner, options?: any);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
declare module "mocha" {
|
||||
export = Mocha;
|
||||
}
|
479
AutoRest/Generators/NodeJS/NodeJS.Tests/typings/moment/moment-node.d.ts
поставляемый
Normal file
479
AutoRest/Generators/NodeJS/NodeJS.Tests/typings/moment/moment-node.d.ts
поставляемый
Normal file
|
@ -0,0 +1,479 @@
|
|||
// Type definitions for Moment.js 2.8.0
|
||||
// Project: https://github.com/timrwood/moment
|
||||
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
declare module moment {
|
||||
|
||||
interface MomentInput {
|
||||
/** Year */
|
||||
years?: number;
|
||||
/** Year */
|
||||
year?: number;
|
||||
/** Year */
|
||||
y?: number;
|
||||
|
||||
/** Month */
|
||||
months?: number;
|
||||
/** Month */
|
||||
month?: number;
|
||||
/** Month */
|
||||
M?: number;
|
||||
|
||||
/** Week */
|
||||
weeks?: number;
|
||||
/** Week */
|
||||
week?: number;
|
||||
/** Week */
|
||||
w?: number;
|
||||
|
||||
/** Day/Date */
|
||||
days?: number;
|
||||
/** Day/Date */
|
||||
day?: number;
|
||||
/** Day/Date */
|
||||
date?: number;
|
||||
/** Day/Date */
|
||||
d?: number;
|
||||
|
||||
/** Hour */
|
||||
hours?: number;
|
||||
/** Hour */
|
||||
hour?: number;
|
||||
/** Hour */
|
||||
h?: number;
|
||||
|
||||
/** Minute */
|
||||
minutes?: number;
|
||||
/** Minute */
|
||||
minute?: number;
|
||||
/** Minute */
|
||||
m?: number;
|
||||
|
||||
/** Second */
|
||||
seconds?: number;
|
||||
/** Second */
|
||||
second?: number;
|
||||
/** Second */
|
||||
s?: number;
|
||||
|
||||
/** Millisecond */
|
||||
milliseconds?: number;
|
||||
/** Millisecond */
|
||||
millisecond?: number;
|
||||
/** Millisecond */
|
||||
ms?: number;
|
||||
}
|
||||
|
||||
interface Duration {
|
||||
humanize(withSuffix?: boolean): string;
|
||||
|
||||
as(units: string): number;
|
||||
|
||||
milliseconds(): number;
|
||||
asMilliseconds(): number;
|
||||
|
||||
seconds(): number;
|
||||
asSeconds(): number;
|
||||
|
||||
minutes(): number;
|
||||
asMinutes(): number;
|
||||
|
||||
hours(): number;
|
||||
asHours(): number;
|
||||
|
||||
days(): number;
|
||||
asDays(): number;
|
||||
|
||||
months(): number;
|
||||
asMonths(): number;
|
||||
|
||||
years(): number;
|
||||
asYears(): number;
|
||||
|
||||
add(n: number, p: string): Duration;
|
||||
add(n: number): Duration;
|
||||
add(d: Duration): Duration;
|
||||
|
||||
subtract(n: number, p: string): Duration;
|
||||
subtract(n: number): Duration;
|
||||
subtract(d: Duration): Duration;
|
||||
|
||||
toISOString(): string;
|
||||
toJSON(): string;
|
||||
}
|
||||
|
||||
interface Moment {
|
||||
format(format: string): string;
|
||||
format(): string;
|
||||
|
||||
fromNow(withoutSuffix?: boolean): string;
|
||||
|
||||
startOf(unitOfTime: string): Moment;
|
||||
endOf(unitOfTime: string): Moment;
|
||||
|
||||
/**
|
||||
* Mutates the original moment by adding time. (deprecated in 2.8.0)
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to add
|
||||
*/
|
||||
add(unitOfTime: string, amount: number): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
*/
|
||||
add(amount: number, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time. Note that the order of arguments can be flipped.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to add (eg "years" / "hours" etc)
|
||||
*/
|
||||
add(amount: string, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
|
||||
*/
|
||||
add(objectLiteral: MomentInput): Moment;
|
||||
/**
|
||||
* Mutates the original moment by adding time.
|
||||
*
|
||||
* @param duration a length of time
|
||||
*/
|
||||
add(duration: Duration): Moment;
|
||||
|
||||
/**
|
||||
* Mutates the original moment by subtracting time. (deprecated in 2.8.0)
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to subtract
|
||||
*/
|
||||
subtract(unitOfTime: string, amount: number): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
* @param amount the amount you want to subtract
|
||||
*/
|
||||
subtract(amount: number, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time. Note that the order of arguments can be flipped.
|
||||
*
|
||||
* @param amount the amount you want to add
|
||||
* @param unitOfTime the unit of time you want to subtract (eg "years" / "hours" etc)
|
||||
*/
|
||||
subtract(amount: string, unitOfTime: string): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param objectLiteral an object literal that describes multiple time units {days:7,months:1}
|
||||
*/
|
||||
subtract(objectLiteral: MomentInput): Moment;
|
||||
/**
|
||||
* Mutates the original moment by subtracting time.
|
||||
*
|
||||
* @param duration a length of time
|
||||
*/
|
||||
subtract(duration: Duration): Moment;
|
||||
|
||||
calendar(): string;
|
||||
calendar(start: Moment): string;
|
||||
calendar(start: Moment, formats: MomentCalendar): string;
|
||||
|
||||
clone(): Moment;
|
||||
|
||||
/**
|
||||
* @return Unix timestamp, or milliseconds since the epoch.
|
||||
*/
|
||||
valueOf(): number;
|
||||
|
||||
local(): Moment; // current date/time in local mode
|
||||
|
||||
utc(): Moment; // current date/time in UTC mode
|
||||
|
||||
isValid(): boolean;
|
||||
invalidAt(): number;
|
||||
|
||||
year(y: number): Moment;
|
||||
year(): number;
|
||||
quarter(): number;
|
||||
quarter(q: number): Moment;
|
||||
month(M: number): Moment;
|
||||
month(M: string): Moment;
|
||||
month(): number;
|
||||
day(d: number): Moment;
|
||||
day(d: string): Moment;
|
||||
day(): number;
|
||||
date(d: number): Moment;
|
||||
date(): number;
|
||||
hour(h: number): Moment;
|
||||
hour(): number;
|
||||
hours(h: number): Moment;
|
||||
hours(): number;
|
||||
minute(m: number): Moment;
|
||||
minute(): number;
|
||||
minutes(m: number): Moment;
|
||||
minutes(): number;
|
||||
second(s: number): Moment;
|
||||
second(): number;
|
||||
seconds(s: number): Moment;
|
||||
seconds(): number;
|
||||
millisecond(ms: number): Moment;
|
||||
millisecond(): number;
|
||||
milliseconds(ms: number): Moment;
|
||||
milliseconds(): number;
|
||||
weekday(): number;
|
||||
weekday(d: number): Moment;
|
||||
isoWeekday(): number;
|
||||
isoWeekday(d: number): Moment;
|
||||
weekYear(): number;
|
||||
weekYear(d: number): Moment;
|
||||
isoWeekYear(): number;
|
||||
isoWeekYear(d: number): Moment;
|
||||
week(): number;
|
||||
week(d: number): Moment;
|
||||
weeks(): number;
|
||||
weeks(d: number): Moment;
|
||||
isoWeek(): number;
|
||||
isoWeek(d: number): Moment;
|
||||
isoWeeks(): number;
|
||||
isoWeeks(d: number): Moment;
|
||||
weeksInYear(): number;
|
||||
isoWeeksInYear(): number;
|
||||
dayOfYear(): number;
|
||||
dayOfYear(d: number): Moment;
|
||||
|
||||
from(f: Moment|string|number|Date|number[], suffix?: boolean): string;
|
||||
to(f: Moment|string|number|Date|number[], suffix?: boolean): string;
|
||||
toNow(withoutPrefix?: boolean): string;
|
||||
|
||||
diff(b: Moment): number;
|
||||
diff(b: Moment, unitOfTime: string): number;
|
||||
diff(b: Moment, unitOfTime: string, round: boolean): number;
|
||||
|
||||
toArray(): number[];
|
||||
toDate(): Date;
|
||||
toISOString(): string;
|
||||
toJSON(): string;
|
||||
unix(): number;
|
||||
|
||||
isLeapYear(): boolean;
|
||||
zone(): number;
|
||||
zone(b: number): Moment;
|
||||
zone(b: string): Moment;
|
||||
utcOffset(): number;
|
||||
utcOffset(b: number): Moment;
|
||||
utcOffset(b: string): Moment;
|
||||
daysInMonth(): number;
|
||||
isDST(): boolean;
|
||||
|
||||
isBefore(): boolean;
|
||||
isBefore(b: Moment|string|number|Date|number[], granularity?: string): boolean;
|
||||
|
||||
isAfter(): boolean;
|
||||
isAfter(b: Moment|string|number|Date|number[], granularity?: string): boolean;
|
||||
|
||||
isSame(b: Moment|string|number|Date|number[], granularity?: string): boolean;
|
||||
isBetween(a: Moment|string|number|Date|number[], b: Moment|string|number|Date|number[], granularity?: string): boolean;
|
||||
|
||||
// Deprecated as of 2.8.0.
|
||||
lang(language: string): Moment;
|
||||
lang(reset: boolean): Moment;
|
||||
lang(): MomentLanguage;
|
||||
|
||||
locale(language: string): Moment;
|
||||
locale(reset: boolean): Moment;
|
||||
locale(): string;
|
||||
|
||||
localeData(language: string): Moment;
|
||||
localeData(reset: boolean): Moment;
|
||||
localeData(): MomentLanguage;
|
||||
|
||||
// Deprecated as of 2.7.0.
|
||||
max(date: Moment|string|number|Date|any[]): Moment;
|
||||
max(date: string, format: string): Moment;
|
||||
|
||||
// Deprecated as of 2.7.0.
|
||||
min(date: Moment|string|number|Date|any[]): Moment;
|
||||
min(date: string, format: string): Moment;
|
||||
|
||||
get(unit: string): number;
|
||||
set(unit: string, value: number): Moment;
|
||||
set(objectLiteral: MomentInput): Moment;
|
||||
}
|
||||
|
||||
type formatFunction = () => string;
|
||||
|
||||
interface MomentCalendar {
|
||||
lastDay?: string | formatFunction;
|
||||
sameDay?: string | formatFunction;
|
||||
nextDay?: string | formatFunction;
|
||||
lastWeek?: string | formatFunction;
|
||||
nextWeek?: string | formatFunction;
|
||||
sameElse?: string | formatFunction;
|
||||
}
|
||||
|
||||
interface BaseMomentLanguage {
|
||||
months ?: any;
|
||||
monthsShort ?: any;
|
||||
weekdays ?: any;
|
||||
weekdaysShort ?: any;
|
||||
weekdaysMin ?: any;
|
||||
relativeTime ?: MomentRelativeTime;
|
||||
meridiem ?: (hour: number, minute: number, isLowercase: boolean) => string;
|
||||
calendar ?: MomentCalendar;
|
||||
ordinal ?: (num: number) => string;
|
||||
}
|
||||
|
||||
interface MomentLanguage extends BaseMomentLanguage {
|
||||
longDateFormat?: MomentLongDateFormat;
|
||||
}
|
||||
|
||||
interface MomentLanguageData extends BaseMomentLanguage {
|
||||
/**
|
||||
* @param formatType should be L, LL, LLL, LLLL.
|
||||
*/
|
||||
longDateFormat(formatType: string): string;
|
||||
}
|
||||
|
||||
interface MomentLongDateFormat {
|
||||
L: string;
|
||||
LL: string;
|
||||
LLL: string;
|
||||
LLLL: string;
|
||||
LT: string;
|
||||
LTS: string;
|
||||
l?: string;
|
||||
ll?: string;
|
||||
lll?: string;
|
||||
llll?: string;
|
||||
lt?: string;
|
||||
lts?: string;
|
||||
}
|
||||
|
||||
interface MomentRelativeTime {
|
||||
future: any;
|
||||
past: any;
|
||||
s: any;
|
||||
m: any;
|
||||
mm: any;
|
||||
h: any;
|
||||
hh: any;
|
||||
d: any;
|
||||
dd: any;
|
||||
M: any;
|
||||
MM: any;
|
||||
y: any;
|
||||
yy: any;
|
||||
}
|
||||
|
||||
interface MomentStatic {
|
||||
version: string;
|
||||
fn: Moment;
|
||||
|
||||
(): Moment;
|
||||
(date: number): Moment;
|
||||
(date: number[]): Moment;
|
||||
(date: string, format?: string, strict?: boolean): Moment;
|
||||
(date: string, format?: string, language?: string, strict?: boolean): Moment;
|
||||
(date: string, formats: string[], strict?: boolean): Moment;
|
||||
(date: string, formats: string[], language?: string, strict?: boolean): Moment;
|
||||
(date: string, specialFormat: () => void, strict?: boolean): Moment;
|
||||
(date: string, specialFormat: () => void, language?: string, strict?: boolean): Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], strict?: boolean): Moment;
|
||||
(date: string, formatsIncludingSpecial: any[], language?: string, strict?: boolean): Moment;
|
||||
(date: Date): Moment;
|
||||
(date: Moment): Moment;
|
||||
(date: Object): Moment;
|
||||
|
||||
utc(): Moment;
|
||||
utc(date: number): Moment;
|
||||
utc(date: number[]): Moment;
|
||||
utc(date: string, format?: string, strict?: boolean): Moment;
|
||||
utc(date: string, format?: string, language?: string, strict?: boolean): Moment;
|
||||
utc(date: string, formats: string[], strict?: boolean): Moment;
|
||||
utc(date: string, formats: string[], language?: string, strict?: boolean): Moment;
|
||||
utc(date: Date): Moment;
|
||||
utc(date: Moment): Moment;
|
||||
utc(date: Object): Moment;
|
||||
|
||||
unix(timestamp: number): Moment;
|
||||
|
||||
invalid(parsingFlags?: Object): Moment;
|
||||
isMoment(): boolean;
|
||||
isMoment(m: any): boolean;
|
||||
isDate(m: any): boolean;
|
||||
isDuration(): boolean;
|
||||
isDuration(d: any): boolean;
|
||||
|
||||
// Deprecated in 2.8.0.
|
||||
lang(language?: string): string;
|
||||
lang(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
locale(language?: string): string;
|
||||
locale(language?: string[]): string;
|
||||
locale(language?: string, definition?: MomentLanguage): string;
|
||||
|
||||
localeData(language?: string): MomentLanguageData;
|
||||
|
||||
longDateFormat: any;
|
||||
relativeTime: any;
|
||||
meridiem: (hour: number, minute: number, isLowercase: boolean) => string;
|
||||
calendar: any;
|
||||
ordinal: (num: number) => string;
|
||||
|
||||
duration(milliseconds: Number): Duration;
|
||||
duration(num: Number, unitOfTime: string): Duration;
|
||||
duration(input: MomentInput): Duration;
|
||||
duration(object: any): Duration;
|
||||
duration(): Duration;
|
||||
|
||||
parseZone(date: string): Moment;
|
||||
|
||||
months(): string[];
|
||||
months(index: number): string;
|
||||
months(format: string): string[];
|
||||
months(format: string, index: number): string;
|
||||
monthsShort(): string[];
|
||||
monthsShort(index: number): string;
|
||||
monthsShort(format: string): string[];
|
||||
monthsShort(format: string, index: number): string;
|
||||
|
||||
weekdays(): string[];
|
||||
weekdays(index: number): string;
|
||||
weekdays(format: string): string[];
|
||||
weekdays(format: string, index: number): string;
|
||||
weekdaysShort(): string[];
|
||||
weekdaysShort(index: number): string;
|
||||
weekdaysShort(format: string): string[];
|
||||
weekdaysShort(format: string, index: number): string;
|
||||
weekdaysMin(): string[];
|
||||
weekdaysMin(index: number): string;
|
||||
weekdaysMin(format: string): string[];
|
||||
weekdaysMin(format: string, index: number): string;
|
||||
|
||||
min(...moments: Moment[]): Moment;
|
||||
max(...moments: Moment[]): Moment;
|
||||
|
||||
normalizeUnits(unit: string): string;
|
||||
relativeTimeThreshold(threshold: string): number|boolean;
|
||||
relativeTimeThreshold(threshold: string, limit:number): boolean;
|
||||
|
||||
/**
|
||||
* Constant used to enable explicit ISO_8601 format parsing.
|
||||
*/
|
||||
ISO_8601(): void;
|
||||
|
||||
defaultFormat: string;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
declare module 'moment' {
|
||||
var moment: moment.MomentStatic;
|
||||
export = moment;
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
// Type definitions for Moment.js 2.8.0
|
||||
// Project: https://github.com/timrwood/moment
|
||||
// Definitions by: Michael Lakerveld <https://github.com/Lakerfield>, Aaron King <https://github.com/kingdango>, Hiroki Horiuchi <https://github.com/horiuchi>, Dick van den Brink <https://github.com/DickvdBrink>, Adi Dahiya <https://github.com/adidahiya>, Matt Brooks <https://github.com/EnableSoftware>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
/// <reference path="moment-node.d.ts" />
|
||||
|
||||
declare var moment: moment.MomentStatic;
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -0,0 +1,126 @@
|
|||
// Type definitions for should.js 3.1.2
|
||||
// Project: https://github.com/visionmedia/should.js
|
||||
// Definitions by: Alex Varju <https://github.com/varju/>, Maxime LUCE <https://github.com/SomaticIT/>
|
||||
// Definitions: https://github.com/borisyankov/DefinitelyTyped
|
||||
|
||||
interface Object {
|
||||
should: ShouldAssertion;
|
||||
}
|
||||
|
||||
interface ShouldAssertion {
|
||||
// basic grammar
|
||||
a: ShouldAssertion;
|
||||
an: ShouldAssertion;
|
||||
and: ShouldAssertion;
|
||||
be: ShouldAssertion;
|
||||
have: ShouldAssertion;
|
||||
with: ShouldAssertion;
|
||||
of: ShouldAssertion;
|
||||
not: ShouldAssertion;
|
||||
|
||||
// validators
|
||||
arguments: ShouldAssertion;
|
||||
empty: ShouldAssertion;
|
||||
ok: ShouldAssertion;
|
||||
true: ShouldAssertion;
|
||||
false: ShouldAssertion;
|
||||
NaN: ShouldAssertion;
|
||||
Infinity: ShouldAssertion;
|
||||
Array: ShouldAssertion;
|
||||
Object: ShouldAssertion;
|
||||
String: ShouldAssertion;
|
||||
Boolean: ShouldAssertion;
|
||||
Number: ShouldAssertion;
|
||||
Error: ShouldAssertion;
|
||||
Function: ShouldAssertion;
|
||||
eql(expected: any, description?: string): ShouldAssertion;
|
||||
equal(expected: any, description?: string): ShouldAssertion;
|
||||
within(start: number, finish: number, description?: string): ShouldAssertion;
|
||||
approximately(value: number, delta: number, description?: string): ShouldAssertion;
|
||||
type(expected: any, description?: string): ShouldAssertion;
|
||||
instanceof(constructor: Function, description?: string): ShouldAssertion;
|
||||
above(n: number, description?: string): ShouldAssertion;
|
||||
below(n: number, description?: string): ShouldAssertion;
|
||||
match(other: {}, description?: string): ShouldAssertion;
|
||||
match(other: (val: any) => any, description?: string): ShouldAssertion;
|
||||
match(regexp: RegExp, description?: string): ShouldAssertion;
|
||||
match(other: any, description?: string): ShouldAssertion;
|
||||
matchEach(other: {}, description?: string): ShouldAssertion;
|
||||
matchEach(other: (val: any) => any, description?: string): ShouldAssertion;
|
||||
matchEach(regexp: RegExp, description?: string): ShouldAssertion;
|
||||
matchEach(other: any, description?: string): ShouldAssertion;
|
||||
matchAny(other: {}, description?: string): ShouldAssertion;
|
||||
matchAny(other: (val: any) => any, description?: string): ShouldAssertion;
|
||||
matchAny(regexp: RegExp, description?: string): ShouldAssertion;
|
||||
matchAny(other: any, description?: string): ShouldAssertion;
|
||||
length(n: number, description?: string): ShouldAssertion;
|
||||
property(name: string, description?: string): ShouldAssertion;
|
||||
property(name: string, val: any, description?: string): ShouldAssertion;
|
||||
properties(names: string[]): ShouldAssertion;
|
||||
properties(name: string): ShouldAssertion;
|
||||
properties(descriptor: any): ShouldAssertion;
|
||||
properties(...properties: string[]): ShouldAssertion;
|
||||
ownProperty(name: string, description?: string): ShouldAssertion;
|
||||
contain(obj: any): ShouldAssertion;
|
||||
containEql(obj: any): ShouldAssertion;
|
||||
containDeep(obj: any): ShouldAssertion;
|
||||
keys(...allKeys: string[]): ShouldAssertion;
|
||||
keys(allKeys: string[]): ShouldAssertion;
|
||||
header(field: string, val?: string): ShouldAssertion;
|
||||
status(code: number): ShouldAssertion;
|
||||
json: ShouldAssertion;
|
||||
html: ShouldAssertion;
|
||||
startWith(expected: string, message?: any): ShouldAssertion;
|
||||
endWith(expected: string, message?: any): ShouldAssertion;
|
||||
throw(message?: any): ShouldAssertion;
|
||||
|
||||
// deprecated
|
||||
include(obj: any, description?: string): ShouldAssertion;
|
||||
includeEql(obj: any[], description?: string): ShouldAssertion;
|
||||
|
||||
// aliases
|
||||
exactly(expected: any, description?: string): ShouldAssertion;
|
||||
instanceOf(constructor: Function, description?: string): ShouldAssertion;
|
||||
throwError(message?: any): ShouldAssertion;
|
||||
lengthOf(n: number, description?: string): ShouldAssertion;
|
||||
key(key: string): ShouldAssertion;
|
||||
haveOwnProperty(name: string, description?: string): ShouldAssertion;
|
||||
greaterThan(n: number, description?: string): ShouldAssertion;
|
||||
lessThan(n: number, description?: string): ShouldAssertion;
|
||||
}
|
||||
|
||||
interface ShouldInternal {
|
||||
// should.js's extras
|
||||
exist(actual: any, msg?: string): void;
|
||||
exists(actual: any, msg?: string): void;
|
||||
not: ShouldInternal;
|
||||
}
|
||||
|
||||
interface Internal extends ShouldInternal {
|
||||
(obj: any): ShouldAssertion;
|
||||
|
||||
// node.js's assert functions
|
||||
fail(actual: any, expected: any, message: string, operator: string): void;
|
||||
assert(value: any, message: string): void;
|
||||
ok(value: any, message?: string): void;
|
||||
equal(actual: any, expected: any, message?: string): void;
|
||||
notEqual(actual: any, expected: any, message?: string): void;
|
||||
deepEqual(actual: any, expected: any, message?: string): void;
|
||||
notDeepEqual(actual: any, expected: any, message?: string): void;
|
||||
strictEqual(actual: any, expected: any, message?: string): void;
|
||||
notStrictEqual(actual: any, expected: any, message?: string): void;
|
||||
throws(block: any, error?: any, message?: string): void;
|
||||
doesNotThrow(block: any, message?: string): void;
|
||||
ifError(value: any): void;
|
||||
inspect(value: any, obj: any): any;
|
||||
}
|
||||
|
||||
declare var should: Internal;
|
||||
declare var Should: Internal;
|
||||
interface Window {
|
||||
Should: Internal;
|
||||
}
|
||||
|
||||
declare module "should" {
|
||||
export = should;
|
||||
}
|
|
@ -0,0 +1,5 @@
|
|||
/// <reference path="mocha/mocha.d.ts" />
|
||||
/// <reference path="moment/moment-node.d.ts" />
|
||||
/// <reference path="moment/moment.d.ts" />
|
||||
/// <reference path="node/node.d.ts" />
|
||||
/// <reference path="should/should.d.ts" />
|
Загрузка…
Ссылка в новой задаче