@opentermsarchive/engine 0.32.1 → 0.33.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentermsarchive/engine",
3
- "version": "0.32.1",
3
+ "version": "0.33.0",
4
4
  "description": "Tracks and makes visible changes to the terms of online services",
5
5
  "homepage": "https://github.com/OpenTermsArchive/engine#readme",
6
6
  "bugs": {
@@ -57,7 +57,6 @@ describe('Docs API', () => {
57
57
  context('When requested as HTML', () => {
58
58
  before(async () => {
59
59
  response = await request(app).get(`${basePath}/v1/docs/`);
60
- console.log(response);
61
60
  });
62
61
 
63
62
  it('responds with 200 status code', () => {
@@ -72,12 +72,29 @@ const router = express.Router();
72
72
  * schema:
73
73
  * type: array
74
74
  * items:
75
- * $ref: '#/components/schemas/Service'
75
+ * type: object
76
+ * properties:
77
+ * id:
78
+ * type: string
79
+ * description: The ID of the service.
80
+ * name:
81
+ * type: string
82
+ * description: The name of the service.
83
+ * terms:
84
+ * type: array
85
+ * description: The declared terms types for this service.
86
+ * items:
87
+ * type: object
88
+ * properties:
89
+ * type:
90
+ * type: string
91
+ * description: The type of terms.
76
92
  */
77
93
  router.get('/services', (req, res) => {
78
94
  res.status(200).json(Object.values(services).map(service => ({
79
95
  id: service.id,
80
96
  name: service.name,
97
+ terms: service.getTermsTypes().map(type => ({ type })),
81
98
  })));
82
99
  });
83
100
 
@@ -37,6 +37,20 @@ describe('Services API', () => {
37
37
  expect(service).to.have.property('name');
38
38
  });
39
39
  });
40
+
41
+ it('each service should have a terms array', () => {
42
+ response.body.forEach(service => {
43
+ expect(service).to.have.property('terms').that.is.an('array');
44
+ });
45
+ });
46
+
47
+ it('each terms should have a type', () => {
48
+ response.body.forEach(service => {
49
+ service.terms.forEach(terms => {
50
+ expect(terms).to.have.property('type');
51
+ });
52
+ });
53
+ });
40
54
  });
41
55
 
42
56
  describe('GET /service/:serviceId', () => {