Skip to content

Commit 26ad7db

Browse files
authoredAug 18, 2020
fix(tests): content-tags (#427)
We accidentally only ran tests for tags. This PR removes the only, and ensures unique names for all tags created during tests to avoid name collision.
1 parent e037bc5 commit 26ad7db

File tree

2 files changed

+6
-12
lines changed

2 files changed

+6
-12
lines changed
 

‎test/integration/integration-tests.js

+1-5
Original file line numberDiff line numberDiff line change
@@ -375,18 +375,14 @@ test('Logs request and response with custom loggers', (t) => {
375375
})
376376
})
377377

378-
test.only('gets V2 space for tag tests', (t) => {
379-
console.debug('1')
378+
test('gets V2 space for tag tests', (t) => {
380379
v2Client.getSpace('w6xueg32zr68').then((space) => {
381380
tagTests(t, space)
382381
test.onFinish(() => deleteAllTags(space, 'master'))
383382
})
384383
})
385384

386385
async function deleteAllTags(space, environmentName) {
387-
console.debug('6')
388-
389-
console.log('delete all test tags')
390386
const environment = await space.getEnvironment(environmentName)
391387
const tags = await environment.getTags(0, 1000)
392388
for (let index = 0; index < tags.total; index++) {

‎test/integration/tag-integration.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
async function createRandomTag(environment) {
22
const tagId = randomTagId()
33
const tagName = 'Tag ' + tagId
4-
console.log(`create random tag ${tagName}:${tagId}`)
54
return environment.createTag(tagId, tagName)
65
}
76

@@ -24,15 +23,16 @@ async function createUpdateTagTest(t, space) {
2423
const tagName = 'Tag ' + tagId
2524
const environment = await space.getEnvironment('master')
2625
const tag = await environment.createTag(tagId, tagName)
27-
tag.name = 'new tag name'
26+
const newTagId = 'createUpdateTagTest-' + randomTagId()
27+
tag.name = newTagId
2828
const result = await tag.update()
29-
t.equals(result.name, 'new tag name', 'tag name should be updated')
29+
t.equals(result.name, newTagId, 'tag name should be updated')
3030
t.equals(result.sys.id, tagId, 'tag id should be equal')
3131
}
3232
async function createReadTagTest(t, space) {
3333
t.plan(2)
3434
const tagId = randomTagId()
35-
const tagName = 'Tag ' + tagId
35+
const tagName = 'createReadTagTest-' + tagId
3636
const environment = await space.getEnvironment('master')
3737
await environment.createTag(tagId, tagName)
3838
const result = await environment.getTag(tagId)
@@ -43,7 +43,7 @@ async function createReadTagTest(t, space) {
4343
async function createReadTagsTest(t, space) {
4444
t.plan(2)
4545
const tagId = randomTagId()
46-
const tagName = 'Tag ' + tagId
46+
const tagName = 'createReadTagsTest-' + tagId
4747
const environment = await space.getEnvironment('master')
4848

4949
for (let index = 0; index < 10; index++) {
@@ -67,11 +67,9 @@ async function writeEntityTagsTest(t, entity, environment) {
6767
},
6868
}
6969
entity.metadata.tags.push(tagLink)
70-
console.log(`entity update`)
7170
const updatedEntity = await entity.update()
7271
t.deepEqual(updatedEntity.metadata.tags[0], tagLink, 'tag created on entity')
7372
updatedEntity.metadata.tags = []
74-
console.log(`entity update`)
7573
const noTagsEntity = await updatedEntity.update()
7674
t.deepEqual(noTagsEntity.metadata.tags, [], 'tag removed from entity')
7775
}

0 commit comments

Comments
 (0)
Please sign in to comment.