Skip to content

Commit b8c6d94

Browse files
committed
commit the actual results
1 parent 3340340 commit b8c6d94

File tree

1 file changed

+53
-3
lines changed

1 file changed

+53
-3
lines changed

src/to-typescript.spec.ts

Lines changed: 53 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ const jsonSchema: StandardJSONSchema = {
116116
required: ['name', 'age']
117117
};
118118

119-
describe.only('toTypescriptTypeDefinition', function() {
119+
describe('toTypescriptTypeDefinition', function() {
120120
it('converts a MongoDB JSON schema to TypeScript', async function() {
121121
const databaseName = 'myDb';
122122
const collectionName = 'myCollection';
@@ -125,7 +125,45 @@ describe.only('toTypescriptTypeDefinition', function() {
125125

126126
console.log(inspect(schema, { depth: null }));
127127

128-
assert.equal(toTypescriptTypeDefinition(databaseName, collectionName, schema), '');
128+
assert.equal(toTypescriptTypeDefinition(databaseName, collectionName, schema), `module myDb {
129+
type myCollection = {
130+
_id?: bson.ObjectId;
131+
array?: bson.Double[];
132+
binaries?: {
133+
binaryOld?: bson.Binary;
134+
compressedTimeSeries?: bson.Binary;
135+
custom?: bson.Binary;
136+
encrypted?: bson.Binary;
137+
functionData?: bson.Binary;
138+
generic?: bson.Binary;
139+
md5?: bson.Binary;
140+
uuid?: bson.Binary;
141+
uuidOld?: bson.Binary
142+
};
143+
binData?: bson.Binary;
144+
boolean?: boolean;
145+
date?: bson.Date;
146+
dbRef?: bson.DBPointer;
147+
decimal?: bson.Decimal128;
148+
double?: bson.Double;
149+
doubleThatIsAlsoAnInteger?: bson.Double;
150+
int?: bson.Int32;
151+
javascript?: bson.Code;
152+
javascriptWithScope?: bson.Code;
153+
long?: bson.Long;
154+
maxKey?: bson.MaxKey;
155+
minKey?: bson.MinKey;
156+
null?: null;
157+
object?: {
158+
key?: string
159+
};
160+
objectId?: bson.ObjectId;
161+
regex?: bson.BSONRegExp;
162+
string?: string;
163+
symbol?: bson.BSONSymbol;
164+
timestamp?: bson.Timestamp
165+
};
166+
};`);
129167
});
130168

131169
it('converts a standard JSON schema to TypeScript', function() {
@@ -134,6 +172,18 @@ describe.only('toTypescriptTypeDefinition', function() {
134172

135173
console.log(inspect(jsonSchema, { depth: null }));
136174

137-
assert.equal(toTypescriptTypeDefinition(databaseName, collectionName, jsonSchema), '');
175+
assert.equal(toTypescriptTypeDefinition(databaseName, collectionName, jsonSchema), `module myDb {
176+
type myCollection = {
177+
name?: string;
178+
age?: number;
179+
address?: {
180+
street?: string;
181+
city?: string;
182+
state?: string;
183+
postalCode?: string
184+
};
185+
hobbies?: string[]
186+
};
187+
};`);
138188
});
139189
});

0 commit comments

Comments
 (0)