Skip to content

Commit 0a53635

Browse files
committed
chore: sanity test lint fixes and trackedExpect cleanup
- Add trackedExpect to sanity API tests for Mochawesome expected/actual reporting - Fix no-unused-vars, no-undef across sanity-check API tests and helpers - Remove unused imports and variables (contentType, entry, role, workflow, etc.) - Fix no-return-await in role-test; add after/before to stack-test and team-test - ESLint: no-useless-escape off for test/**; promise/param-names fix in testSetup - Remove unused formatValueCompact and headersToCurl from testHelpers; sanity.js import cleanup - Update .talismanrc checksums for modified sanity test files
1 parent ed7c18e commit 0a53635

37 files changed

+1160
-1325
lines changed

.eslintrc.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ module.exports = {
2525
{
2626
files: ['test/**/*.js'],
2727
rules: {
28-
'no-unused-expressions': 'off'
28+
'no-unused-expressions': 'off',
29+
'no-useless-escape': 'off'
2930
}
3031
}
3132
]

.talismanrc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ fileignoreconfig:
2828
checksum: 2597efae3c1ab8cc173d5bf205f1c76932211f8e0eb2a16444e055d83481976c
2929
# Sanity check test files - use process.env for all secrets (no hardcoded values)
3030
- filename: test/sanity-check/api/environment-test.js
31-
checksum: e554b04ac510600c8489870a6097ee5f824f5b5e0f1a6358d8ef4ad24b3b0c12
31+
checksum: 91d76e6a2c4639db04071a30a9212df32777ab5f0e3a23dc101f4d62c13609b0
3232
- filename: test/sanity-check/env.example.txt
3333
checksum: 3339944cd20d6d72f70a92e54af3de96736250b4b7117a29577575f9b52ed611
3434
- filename: test/sanity-check/api/token-test.js
@@ -42,7 +42,7 @@ fileignoreconfig:
4242
- filename: test/sanity-check/mock/global-fields.js
4343
checksum: fb89a4a5028066689de774ca2f990c25c8a3acc46c0c6b97fee410f491853cc1
4444
- filename: test/sanity-check/utility/ContentstackClient.js
45-
checksum: 8ad5bf958e40cb65181dec35842e2e292f51cca0f7ca1e87c67cb58cd16f139d
45+
checksum: 96ff5412eed26f5a27621dd307c9463f793a3e8dd977fe1e5453da78507ac2f6
4646
- filename: test/sanity-check/api/variantGroup-test.js
4747
checksum: 3fc26eca704bc9ce4650056c81be45f3586d3c947a18dfec58fee4447de56360
4848
- filename: test/sanity-check/api/workflow-test.js
@@ -54,7 +54,7 @@ fileignoreconfig:
5454
- filename: test/sanity-check/sanity.js
5555
checksum: 523725a12c93abdc1b89a1e7ef38021184e7d710f8719290923f835f8d615693
5656
- filename: test/sanity-check/api/user-test.js
57-
checksum: 5f1284561725f99980a800c87d80d2f7b6f56e1efa618adb10bbf87312b0deec
57+
checksum: 01a2224a02f6a0e1cd5fb10e289a349a32a5cf3eb39b9e06787031fde5aa8aca
5858
- filename: test/sanity-check/api/locale-test.js
5959
checksum: 91f8db01791a57c18e925c5896cc1960cdb951e6787fff886c008e17c25d5dea
6060
- filename: test/sanity-check/api/asset-test.js
@@ -68,7 +68,7 @@ fileignoreconfig:
6868
- filename: test/sanity-check/api/release-test.js
6969
checksum: 863c0ef7d65cfd33f245deb636d537c131ad29233ebafd88c223e555c4f80b82
7070
- filename: test/sanity-check/utility/testHelpers.js
71-
checksum: e7fda8860a08f944c58a3745871934d343ac48616d6adbc00ba4f6358b298523
71+
checksum: 204d11d739947259a3303fbe1d92c296dd82975fa8dff67a438853a3828c27a3
7272
- filename: test/sanity-check/api/auditlog-test.js
7373
checksum: 9d325aaf73760359dd4194c52ad01203ed7f078230e45282e84aab2b53613095
7474
- filename: test/sanity-check/api/team-test.js
@@ -78,7 +78,7 @@ fileignoreconfig:
7878
- filename: test/sanity-check/api/branchAlias-test.js
7979
checksum: 0b6cacee74d7636e84ce095198f0234d491b79ea20d3978a742a5495692bd61d
8080
- filename: test/sanity-check/utility/testSetup.js
81-
checksum: caa1fa9867a49bb8a458bab5bbc3cdeaf2f4a44d0f1a21e997db237553ea33ab
81+
checksum: e906e6a93953826857fa701db7094330ef88e342e719f3446e17c823576c3377
8282
- filename: test/sanity-check/api/branch-test.js
8383
checksum: 49c8fd18c59d45e4335f766591711849722206bce34860efa8eced7172f44efa
8484
- filename: test/sanity-check/api/stack-test.js

test/sanity-check/api/contentType-test.js

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* Content Type API Tests
3-
*
3+
*
44
* Comprehensive test suite for:
55
* - Content type CRUD operations
66
* - Complex schema creation (all field types)
@@ -23,10 +23,7 @@ import {
2323
} from '../mock/content-types/index.js'
2424
import {
2525
validateContentTypeResponse,
26-
validateErrorResponse,
27-
generateValidUid,
2826
testData,
29-
safeDeleteContentType,
3027
wait,
3128
trackedExpect
3229
} from '../utility/testHelpers.js'
@@ -76,7 +73,7 @@ describe('Content Type API Tests', () => {
7673

7774
createdCt = ct
7875
testData.contentTypes.simple = ct
79-
76+
8077
// Wait for content type to be fully created
8178
await wait(2000)
8279
})
@@ -153,7 +150,7 @@ describe('Content Type API Tests', () => {
153150

154151
it('should delete a content type', async function () {
155152
this.timeout(30000)
156-
153+
157154
// Create a temporary content type specifically for delete testing
158155
// so we don't delete the simple CT which is needed by downstream tests (workflow, labels, etc.)
159156
const tempCtUid = `temp_del_ct_${Date.now()}`
@@ -165,7 +162,7 @@ describe('Content Type API Tests', () => {
165162
}
166163
})
167164
await wait(2000)
168-
165+
169166
const ct = await stack.contentType(tempCtUid).fetch()
170167
const response = await ct.delete()
171168

@@ -175,7 +172,7 @@ describe('Content Type API Tests', () => {
175172

176173
it('should return 404 for deleted content type', async function () {
177174
this.timeout(30000)
178-
175+
179176
// Create and delete a temp CT to test 404 behavior
180177
const tempCtUid = `temp_404_ct_${Date.now()}`
181178
await stack.contentType().create({
@@ -186,11 +183,11 @@ describe('Content Type API Tests', () => {
186183
}
187184
})
188185
await wait(2000)
189-
186+
190187
const ct = await stack.contentType(tempCtUid).fetch()
191188
await ct.delete()
192189
await wait(2000)
193-
190+
194191
try {
195192
await stack.contentType(tempCtUid).fetch()
196193
expect.fail('Should have thrown an error')
@@ -472,7 +469,6 @@ describe('Content Type API Tests', () => {
472469
// ==========================================================================
473470

474471
describe('Error Handling', () => {
475-
476472
it('should fail to create content type with duplicate UID', async () => {
477473
const ctData = JSON.parse(JSON.stringify(simpleContentType))
478474
ctData.content_type.uid = 'duplicate_test'
@@ -651,20 +647,20 @@ describe('Content Type API Tests', () => {
651647

652648
it('should import content type from JSON file', async function () {
653649
this.timeout(30000)
654-
650+
655651
const importPath = path.join(mockBasePath, 'contentType-import.json')
656-
652+
657653
try {
658654
const response = await stack.contentType().import({
659655
content_type: importPath
660656
})
661-
657+
662658
expect(response).to.be.an('object')
663659
expect(response.uid).to.be.a('string')
664-
660+
665661
importedCtUid = response.uid
666662
testData.contentTypes.imported = response
667-
663+
668664
await wait(2000)
669665
} catch (error) {
670666
// Import might fail if content type with same UID exists
@@ -679,18 +675,18 @@ describe('Content Type API Tests', () => {
679675

680676
it('should fetch imported content type', async function () {
681677
this.timeout(15000)
682-
678+
683679
if (!importedCtUid) {
684680
this.skip()
685681
return
686682
}
687-
683+
688684
const response = await stack.contentType(importedCtUid).fetch()
689-
685+
690686
expect(response).to.be.an('object')
691687
expect(response.uid).to.equal(importedCtUid)
692688
expect(response.title).to.equal('Imported Content Type')
693-
689+
694690
// Verify schema was imported correctly
695691
expect(response.schema).to.be.an('array')
696692
const titleField = response.schema.find(f => f.uid === 'title')
@@ -700,14 +696,14 @@ describe('Content Type API Tests', () => {
700696

701697
it('should validate imported content type options', async function () {
702698
this.timeout(15000)
703-
699+
704700
if (!importedCtUid) {
705701
this.skip()
706702
return
707703
}
708-
704+
709705
const response = await stack.contentType(importedCtUid).fetch()
710-
706+
711707
expect(response.options).to.be.an('object')
712708
expect(response.options.is_page).to.be.true
713709
expect(response.options.singleton).to.be.false

0 commit comments

Comments
 (0)