Skip to content

Commit

Permalink
2.8.0-beta1
Browse files Browse the repository at this point in the history
  • Loading branch information
nozzlegear committed Aug 31, 2017
2 parents 3c593e8 + 656308f commit a5901f4
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 16 deletions.
1 change: 1 addition & 0 deletions index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ export async function configureDatabase<DocType extends CouchDoc>(databaseUrl: s
if (!isOkay) {
docFromDatabase = {
_id: `_design/${designDoc.name}`,
_rev: undefined,
language: "javascript",
views: {}
}
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "davenport",
"version": "2.7.0-beta1",
"version": "2.8.0-beta1",
"description": "A CouchDB client for simplifying common tasks like get, list, create, update and delete. Comes complete with full TypeScript definitions.",
"main": "bin/index.js",
"typings": "bin/index.d.ts",
Expand Down Expand Up @@ -51,4 +51,4 @@
"typescript": "^2.3.3",
"webpack": "^2.2.1"
}
}
}
62 changes: 48 additions & 14 deletions tests/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,9 @@ export class DavenportTestFixture {
const insert = await client.post({
bar: 117,
foo: 22,
hello: "world"
hello: "world",
_id: undefined,
_rev: undefined
})
}

Expand Down Expand Up @@ -172,7 +174,9 @@ export class DavenportTestFixture {
const result = await client.post({
bar: 5,
foo: 4,
hello: "world"
hello: "world",
_id: undefined,
_rev: undefined
});

Expect(typeof (result.id)).toBe("string");
Expand All @@ -186,7 +190,9 @@ export class DavenportTestFixture {
const createResult = await client.post({
bar: 5,
foo: 4,
hello: "world"
hello: "world",
_id: undefined,
_rev: undefined
});
const result = await client.get(createResult.id);

Expand All @@ -202,12 +208,16 @@ export class DavenportTestFixture {
const createResult = await client.post({
bar: 5,
foo: 4,
hello: "world"
hello: "world",
_id: undefined,
_rev: undefined
});
const putResult = await client.put(createResult.id, {
bar: 4,
foo: 3,
hello: "world",
_id: undefined,
_rev: undefined
}, createResult.rev);
const result = await client.get(putResult.id, putResult.rev);

Expand Down Expand Up @@ -271,7 +281,9 @@ export class DavenportTestFixture {
await client.post({
bar: i,
foo: i + 1,
hello: uuid
hello: uuid,
_id: undefined,
_rev: undefined
})
};

Expand All @@ -292,7 +304,9 @@ export class DavenportTestFixture {
await client.post({
bar: i,
foo: i + 1,
hello: uuid
hello: uuid,
_id: undefined,
_rev: undefined
})
};

Expand All @@ -312,7 +326,9 @@ export class DavenportTestFixture {
const createResult = await client.post({
bar: 5,
foo: 4,
hello: "world"
hello: "world",
_id: undefined,
_rev: undefined
});
let error;

Expand All @@ -332,7 +348,9 @@ export class DavenportTestFixture {
const createResult = await client.post({
bar: 5,
foo: 4,
hello: "world"
hello: "world",
_id: undefined,
_rev: undefined
});
const exists = await client.exists(createResult.id);

Expand All @@ -348,6 +366,8 @@ export class DavenportTestFixture {
bar: 5,
foo: 4,
hello: uuid,
_id: undefined,
_rev: undefined
})
const exists = await client.existsByFieldValue(uuid, "hello");

Expand All @@ -363,6 +383,8 @@ export class DavenportTestFixture {
bar: 5,
foo: 4,
hello: uuid,
_id: undefined,
_rev: undefined
})
const exists = await client.existsBySelector({
hello: {
Expand All @@ -381,7 +403,9 @@ export class DavenportTestFixture {
const createResult = await client.post({
bar: 5,
foo: 4,
hello: uuid
hello: uuid,
_id: undefined,
_rev: undefined
});
const copyResult = await client.copy(createResult.id, uuid);
const result = await client.get(copyResult.id);
Expand All @@ -398,7 +422,9 @@ export class DavenportTestFixture {
await client.post({
bar: 5,
foo: 4,
hello: "shwoop"
hello: "shwoop",
_id: undefined,
_rev: undefined
})
}

Expand Down Expand Up @@ -523,7 +549,9 @@ export class DavenportTestFixture {
const docs = range(0, 100).map<TestObject>(i => ({
bar: i,
foo: i * 3,
hello: "world"
hello: "world",
_id: undefined,
_rev: undefined
}))

const client = getClient();
Expand All @@ -546,7 +574,8 @@ export class DavenportTestFixture {
_id: id,
bar: i,
foo: i * 4,
hello: "goodbye"
hello: "goodbye",
_rev: undefined
}
})
const client = getClient();
Expand All @@ -566,14 +595,17 @@ export class DavenportTestFixture {
const existingDocs = await client.bulk(range(0, totalExisting).map<TestObject>(i => ({
bar: i,
foo: i * 5,
hello: "I'm an existing doc, used with the bulkWithConflicts test."
hello: "I'm an existing doc, used with the bulkWithConflicts test.",
_id: undefined,
_rev: undefined
})));
const result = await client.bulk(range(0, totalOperations).map<TestObject>(i => {
const existingDoc = existingDocs[i];
const id = existingDoc ? existingDoc.id : undefined;

return {
_id: id,
_rev: undefined,
bar: i,
foo: i * 5,
hello: "I'm a generated doc, used with the bulkWIthConflicts test."
Expand All @@ -598,7 +630,9 @@ export class DavenportTestFixture {
await Promise.all([0, 1, 2, 3, 4, 5].map(i => client.post({
bar: 5,
foo: i === 0 ? 17 : Math.floor(Math.random() * 30),
hello: hello
hello: hello,
_id: undefined,
_rev: undefined
})));
}

Expand Down

0 comments on commit a5901f4

Please sign in to comment.