Skip to content

Commit d6a9e6d

Browse files
author
ChaiJs Bot
committed
(data): Auto build _data
1 parent 12c3914 commit d6a9e6d

6 files changed

Lines changed: 151 additions & 4 deletions

File tree

_data/plugin_keywords.json

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,9 @@
4848
"async": [
4949
"async"
5050
],
51+
"aws": [
52+
"aws"
53+
],
5154
"Backbone": [
5255
"backbone"
5356
],
@@ -172,6 +175,9 @@
172175
"dom": [
173176
"dom"
174177
],
178+
"dynamodb": [
179+
"dynamodb"
180+
],
175181
"each": [
176182
"each"
177183
],
@@ -489,6 +495,9 @@
489495
"request": [
490496
"request"
491497
],
498+
"reserved": [
499+
"reserved"
500+
],
492501
"response": [
493502
"response"
494503
],

_data/plugins/chai_dynamodb.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"_id":"chai-dynamodb","name":"chai-dynamodb","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"chai-dynamodb","version":"0.1.0","description":"AWS DynamoDB reserved word assertions for Chai","repository":{"type":"git","url":"git+https://github.com/cadam11/chai-dynamodb.git"},"main":"index.js","scripts":{"lint":"eslint index.js /test","test":"nyc mocha","pretest":"npm run lint"},"keywords":["chai","dynamodb","test","assertions","chai-plugin","aws","reserved"],"author":{"name":"Craig Adam","email":"craig@adam11.ca"},"license":"MIT","devDependencies":{"chai":"^4.2.0","eslint":"^2.8.0","mocha":"^8.2.1","nyc":"^15.1.0"},"peerDependencies":{"chai":">= 4.0.0"},"gitHead":"b573b94dfca16b4b3a0d24bd25770f0dba5c018b","bugs":{"url":"https://github.com/cadam11/chai-dynamodb/issues"},"homepage":"https://github.com/cadam11/chai-dynamodb#readme","_id":"chai-dynamodb@0.1.0","_nodeVersion":"14.15.0","_npmVersion":"6.14.8","dist":{"integrity":"sha512-cL6q8UPxyixbalOrAVO4v7PARJdZlJXjRf9gcjTvbHauTPeJn5nki/i6PGdM2VX7a2icScmQCGOgYDG3jZVFsQ==","shasum":"65f900e079dffa642565b9211c2860c316e6eaf2","tarball":"https://registry.npmjs.org/chai-dynamodb/-/chai-dynamodb-0.1.0.tgz","fileCount":5,"unpackedSize":20416,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgCMNrCRA9TVsSAnZWagAAoa4P/ictLxMWa6jcl8xb4rwj\n6wq2k9iKyJKS1+Vh8mB1r8LacSg81R3v+sweo2atPluvvJkqK0ZbuOZsa0Bx\nsIr9VKzh4Aw1Q6T3SYgQAMSfjFJPOu9VRtD7+a2SOf6z+XGpzVsQ0zxUghl3\n7yw3hIzRE593di1gku13ZOq72MBtBY8jkWi9LBDRQ3ndhp8cOcOrbkPe27QN\nuVY+qm5cr1o5PoFmhZPAslPSDEpXEu2siZZELkAKlwtWFH87VmQ7cwnev2Yp\n6GhCWu7xl5tTfZGZelfaIbtroTKNdbyZBfy/guvRkbpD4bCqUN6/r1l2PQ7L\nIm/NeYnvzGrzVIT/N1L/TKjFzKb7CVUnMqwvKcDkApaHbkxnSuWh8KPJdm/m\n0zT2MKjwroIIvp34YHToKHINUV7Uvbzx6shTbhDxP10ZXonJpktVk4vr02FH\nksxYr2t+/4PVah/ZyViUvcuppm+QCBmAYBSsov5UBPfVkUQKM1buRxDmYgZ+\n+PzTV94wXUhcFD2o5uU4jbZcw9/E/ynSs8BckGmpP7M8+2E9+yfukPhYAXOW\nFU92PN9bTGHtL6/cu3JJLKDALxrYnh4XNrvZuLb2fTbEZfkYJiQaxaXj+CnS\nuMtvNoZiw04i1PCALMj8PHNIKWhzKB17QIWFGn5kqGN/0Y9z3wTRzcW1RfhD\nC8nO\r\n=aa4w\r\n-----END PGP SIGNATURE-----\r\n"},"_npmUser":{"name":"cadam11","email":"craig@adam11.ca"},"directories":{},"maintainers":[{"name":"cadam11","email":"craig@adam11.ca"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/chai-dynamodb_0.1.0_1611187050964_0.5543907240628865"},"_hasShrinkwrap":false}},"time":{"created":"2021-01-20T23:57:30.964Z","0.1.0":"2021-01-20T23:57:31.141Z","modified":"2021-01-20T23:57:33.394Z"},"maintainers":[{"name":"cadam11","email":"craig@adam11.ca"}],"description":"AWS DynamoDB reserved word assertions for Chai","homepage":"https://github.com/cadam11/chai-dynamodb#readme","keywords":["chai","dynamodb","test","assertions","chai-plugin","aws","reserved"],"repository":{"type":"git","url":"git+https://github.com/cadam11/chai-dynamodb.git"},"author":{"name":"Craig Adam","email":"craig@adam11.ca"},"bugs":{"url":"https://github.com/cadam11/chai-dynamodb/issues"},"license":"MIT","readme":"# chai-dynamodb\n\nA [Chai](https://www.chaijs.com/) plugin that adds a matcher to check for the use of a [DynamoDB reserved word](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html) in a string. Very useful for testing AWS Lambda code!\n\n[![NPM Version](https://img.shields.io/npm/v/chai-dynamodb.svg?style=flat)]()\n[![NPM License](https://img.shields.io/npm/l/chai-dynamodb.svg?style=flat)](http://www.tldrlegal.com/license/mit-license)\n[![NPM Downloads](https://img.shields.io/npm/dt/chai-dynamodb.svg?style=flat)]() \n[![NPM](https://nodei.co/npm/chai-dynamodb.png?downloads=true)](https://www.npmjs.com/package/chai-dynamodb)\n\n## Using\n\nAlso see the [tests](https://github.com/cadam11/chai-dynamodb/tree/master/test/)\n\n### browser-side\n\nInclude chai-dynamodb after Chai:\n\n <script src=\"chai.js\"></script>\n <script src=\"chai-dynamodb.js\"></script>\n\n### server-side\n\nHave chai use chai-dynamodb:\n\n```javascript\nvar chai = require('chai');\nchai.use(require('chai-dynamodb'));\n```\n\n## Assertions\n\nCheck any string for a DynamoDB reserved word that is **not** prefixed by either `#` or `:` (idiomatically used to prefix expression attribute names and values respectively). The assertion is true if the string doesn't have any reserved words that would cause a call to DynamoDB to fail.\n\n### noReservedWords\n\n```javascript\nconst safe = 'id, phone, email';\nconst notSafe = 'id, name, phone, email';\nconst usingAttributeNamePrefix = 'id, #name, phone, email';\nconst usingAttributeValuePrefix = 'username = :name';\n\n// using should-style assertions\nsafe.should.have.noReservedWords();\nnotSafe.should.have.noReservedWords(); // fails\nusingAttributeNamePrefix.should.have.noReservedWords();\nusingAttributeValuePrefix.should.have.noReservedWords();\n\n// using expect-style assertions\nexpect(safe).to.have.noReservedWords();\nexpect(notSafe).to.have.noReservedWords(); // fails\nexpect(usingAttributeNamePrefix).to.have.noReservedWords();\nexpect(usingAttributeValuePrefix).to.have.noReservedWords();\n\n// using tdd assertions\nassert.noReservedWords(safe);\nassert.noReservedWords(notSafe); // fails\nassert.noReservedWords(usingAttributeNamePrefix);\nassert.noReservedWords(usingAttributeValuePrefix);\n```\n\n### noReservedWordsExcept\n\nUseful when there is planned use of specific keywords. Takes a single **string** or **array** of strings as its argument. Not case-sensitive.\n\n```javascript\nconst usingAttributeNamePrefix = 'SET #name = :fullname';\nconst usingAttributeValuePrefix = 'SET username = :name';\nconst missingPrefix = 'SET username = name';\n\n// using should-style assertions\nusingAttributeNamePrefix.should.have.noReservedWordsExcept('set');\nusingAttributeValuePrefix.should.have.noReservedWordsExcept('SET');\nmissingPrefix.should.have.noReservedWordsExcept(['SET', 'NAME']);\nmissingPrefix.should.have.noReservedWordsExcept('SET'); // fails\n\n// using expect-style assertions\nexpect(usingAttributeNamePrefix).to.have.noReservedWordsExcept('set');\nexpect(usingAttributeValuePrefix).to.have.noReservedWordsExcept('SET');\nexpect(missingPrefix).to.have.noReservedWordsExcept(['SET', 'NAME']);\nexpect(missingPrefix).to.have.noReservedWordsExcept('SET'); // fails\n\n// using tdd assertions\nassert.noReservedWordsExcept(usingAttributeNamePrefix, 'set');\nassert.noReservedWordsExcept(usingAttributeValuePrefix, 'SET');\nassert.noReservedWordsExcept(missingPrefix, ['SET', 'NAME']);\nassert.noReservedWordsExcept(missingPrefix, 'SET'); // fails\n```\n\n## Limitations\n\nDynamoDB is an actively developed product at AWS, so it's possible they'll add more to the current reserved list of **573** words. This library can be a helpful early protection against the small mistakes that plague us all, but if it's mission-critical you should probably check https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html yourself.\n","readmeFilename":"README.md"}

_data/plugins/chai_luxon.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

_data/plugins/chai_sip.json

Lines changed: 1 addition & 1 deletion
Large diffs are not rendered by default.

plugins/chai_dynamodb.md

Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
1+
---
2+
layout: plugin
3+
permalink: plugins/chai-dynamodb/
4+
pluginName: chai-dynamodb
5+
---
6+
7+
# chai-dynamodb
8+
9+
A [Chai](https://www.chaijs.com/) plugin that adds a matcher to check for the use of a [DynamoDB reserved word](https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html) in a string. Very useful for testing AWS Lambda code!
10+
11+
[![NPM Version](https://img.shields.io/npm/v/chai-dynamodb.svg?style=flat)]()
12+
[![NPM License](https://img.shields.io/npm/l/chai-dynamodb.svg?style=flat)](http://www.tldrlegal.com/license/mit-license)
13+
[![NPM Downloads](https://img.shields.io/npm/dt/chai-dynamodb.svg?style=flat)]()
14+
[![NPM](https://nodei.co/npm/chai-dynamodb.png?downloads=true)](https://www.npmjs.com/package/chai-dynamodb)
15+
16+
## Using
17+
18+
Also see the [tests](https://github.com/cadam11/chai-dynamodb/tree/master/test/)
19+
20+
### browser-side
21+
22+
Include chai-dynamodb after Chai:
23+
24+
<script src="chai.js"></script>
25+
<script src="chai-dynamodb.js"></script>
26+
27+
### server-side
28+
29+
Have chai use chai-dynamodb:
30+
31+
```javascript
32+
var chai = require('chai');
33+
chai.use(require('chai-dynamodb'));
34+
```
35+
36+
## Assertions
37+
38+
Check any string for a DynamoDB reserved word that is **not** prefixed by either `#` or `:` (idiomatically used to prefix expression attribute names and values respectively). The assertion is true if the string doesn't have any reserved words that would cause a call to DynamoDB to fail.
39+
40+
### noReservedWords
41+
42+
```javascript
43+
const safe = 'id, phone, email';
44+
const notSafe = 'id, name, phone, email';
45+
const usingAttributeNamePrefix = 'id, #name, phone, email';
46+
const usingAttributeValuePrefix = 'username = :name';
47+
48+
// using should-style assertions
49+
safe.should.have.noReservedWords();
50+
notSafe.should.have.noReservedWords(); // fails
51+
usingAttributeNamePrefix.should.have.noReservedWords();
52+
usingAttributeValuePrefix.should.have.noReservedWords();
53+
54+
// using expect-style assertions
55+
expect(safe).to.have.noReservedWords();
56+
expect(notSafe).to.have.noReservedWords(); // fails
57+
expect(usingAttributeNamePrefix).to.have.noReservedWords();
58+
expect(usingAttributeValuePrefix).to.have.noReservedWords();
59+
60+
// using tdd assertions
61+
assert.noReservedWords(safe);
62+
assert.noReservedWords(notSafe); // fails
63+
assert.noReservedWords(usingAttributeNamePrefix);
64+
assert.noReservedWords(usingAttributeValuePrefix);
65+
```
66+
67+
### noReservedWordsExcept
68+
69+
Useful when there is planned use of specific keywords. Takes a single **string** or **array** of strings as its argument. Not case-sensitive.
70+
71+
```javascript
72+
const usingAttributeNamePrefix = 'SET #name = :fullname';
73+
const usingAttributeValuePrefix = 'SET username = :name';
74+
const missingPrefix = 'SET username = name';
75+
76+
// using should-style assertions
77+
usingAttributeNamePrefix.should.have.noReservedWordsExcept('set');
78+
usingAttributeValuePrefix.should.have.noReservedWordsExcept('SET');
79+
missingPrefix.should.have.noReservedWordsExcept(['SET', 'NAME']);
80+
missingPrefix.should.have.noReservedWordsExcept('SET'); // fails
81+
82+
// using expect-style assertions
83+
expect(usingAttributeNamePrefix).to.have.noReservedWordsExcept('set');
84+
expect(usingAttributeValuePrefix).to.have.noReservedWordsExcept('SET');
85+
expect(missingPrefix).to.have.noReservedWordsExcept(['SET', 'NAME']);
86+
expect(missingPrefix).to.have.noReservedWordsExcept('SET'); // fails
87+
88+
// using tdd assertions
89+
assert.noReservedWordsExcept(usingAttributeNamePrefix, 'set');
90+
assert.noReservedWordsExcept(usingAttributeValuePrefix, 'SET');
91+
assert.noReservedWordsExcept(missingPrefix, ['SET', 'NAME']);
92+
assert.noReservedWordsExcept(missingPrefix, 'SET'); // fails
93+
```
94+
95+
## Limitations
96+
97+
DynamoDB is an actively developed product at AWS, so it's possible they'll add more to the current reserved list of **573** words. This library can be a helpful early protection against the small mistakes that plague us all, but if it's mission-critical you should probably check https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ReservedWords.html yourself.

plugins/chai_luxon.md

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,10 @@ pluginName: chai-luxon
99
A [Chai](https://www.chaijs.com/) plugin that adds matchers for dates and formatted date strings powered by [Luxon](https://moment.github.io/luxon/)
1010

1111
[![NPM Version](https://img.shields.io/npm/v/chai-luxon.svg?style=flat)]()
12-
[![NPM License](https://img.shields.io/npm/l/all-contributors.svg?style=flat)](http://www.tldrlegal.com/license/mit-license)
12+
[![NPM License](https://img.shields.io/npm/l/chai-luxon.svg?style=flat)](http://www.tldrlegal.com/license/mit-license)
1313
[![NPM Downloads](https://img.shields.io/npm/dt/chai-luxon.svg?style=flat)]()
14-
[![NPM](https://nodei.co/npm/chai-luxon.png?downloads=true)](https://www.npmjs.com/package/chai-luxon)
14+
[![NPM](https://nodei.co/npm/chai-luxon.png?downloads=true)](https://www.npmjs.com/package/chai-luxon)
15+
1516
## Using
1617

1718
Also see the [tests](https://github.com/cadam11/chai-luxon/tree/master/test/)
@@ -106,6 +107,45 @@ assert.afterDateTime(oneDayLater, luxonDateTime, 'month', 'custom error message'
106107
assert.afterDateTime(oneDayLater, luxonDateTime, 'custom error message');
107108
```
108109

110+
## Date-part only
111+
112+
The library includes convenience methods for comparing only the date portion of DateTime values. These convenience methods are aliases for using a granularity of 'day' with the above matchers. All the same date formats (object, JS Date, string, etc) are supported in the same way.
113+
114+
### sameDate, beforeDate, afterdate
115+
116+
```javascript
117+
const date = DateTime.fromISO('2020-04-21T12:00:00Z');
118+
const oneHourLater = date.plus({ hour: 1 });
119+
const oneHourEarlier = date.minus({ hour: 1 });
120+
const oneDayLater = date.plus({ day: 1 });
121+
const oneDayEarlier = date.minus({ day: 1 });
122+
123+
// using should-style assertions
124+
date.should.be.sameDate(oneHourLater);
125+
date.should.be.beforeDate(oneHourLater); // fails
126+
date.should.be.beforeDate(oneDayLater);
127+
date.should.be.afterDate(oneHourEarlier); // fails
128+
date.should.be.afterDate(oneDayLater);
129+
130+
// using expect-style assertions
131+
expect(date).to.be.sameDate(oneHourLater);
132+
expect(date).to.be.beforeDate(oneHourLater); // fails
133+
expect(date).to.be.beforeDate(oneDayLater);
134+
expect(date).to.be.afterDate(oneHourEarlier); // fails
135+
expect(date).to.be.afterDate(oneDayLater);
136+
137+
// using tdd assertions
138+
assert.sameDate(date, oneHourLater);
139+
assert.beforeDate(date, oneDayLater);
140+
assert.beforeDate(date, oneHourLater); // fails
141+
assert.afterDate(oneDayLater, date);
142+
assert.afterDate(oneDayLater, oneHourLater); // fails
143+
```
144+
145+
## Limitations
146+
147+
Strings are limited to ISO-8601 strings only. Other string Date/Time formats aren't guaranteed to work (and probably won't).
148+
109149
# Thanks
110150

111151
Thanks to [picardy](https://github.com/picardy/chai-moment/) for chai-moment, which was the basis for this.

0 commit comments

Comments
 (0)