Skip to content

Commit

Permalink
test: fix mock not found error in failing tests due to using a differ…
Browse files Browse the repository at this point in the history
…ent project id in new recorded mocks than was originally used
  • Loading branch information
nflatley-zengenti committed Oct 8, 2024
1 parent 95613e5 commit 14f6b28
Show file tree
Hide file tree
Showing 7 changed files with 3,168 additions and 90 deletions.
6 changes: 3 additions & 3 deletions packages/html-canvas/test/mocking/mocks.mts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class NockMocker {
if (USE_MOCKS) {
config.rootUrl = 'https://mock-cms.cloud.contensis.com';
config.clientDetails = { clientId: 'mock', clientSecret: 'mock' };
config.projectId = 'canvas'
config.projectId = 'canvasPackages';
}
return config;
};
Expand Down Expand Up @@ -91,12 +91,12 @@ export class NockMocker {
this.files.checkDir(filename);
fs.writeFileSync(
filename,
JSON.stringify(recorded)
JSON.stringify(recorded, null, 2)
.replaceAll(`${process.env.clientId}`, 'mock')
.replaceAll(`${process.env.sharedSecret}`, 'mock')
.replaceAll(`${process.env.rootUrl}`, 'https://mock-cms.cloud.contensis.com')
);
}
}
};

loadMocks = () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
{
"operation": "createHtmlParser_client_contentTypeId_fieldId",
"response": [{ "type": "_heading", "id": "b925ade9", "properties": { "level": 1 }, "value": "test" }],
"response": [
{
"type": "_heading",
"id": "9c0566b1",
"properties": {
"level": 1
},
"value": "test"
}
],
"nockCalls": [
{
"scope": "https://mock-cms.cloud.contensis.com:443",
Expand All @@ -9,7 +18,7 @@
"body": "scope=Security_Administrator%20ContentType_Read%20ContentType_Write%20ContentType_Delete%20Entry_Read%20Entry_Write%20Entry_Delete%20Project_Read%20Project_Write%20Project_Delete%20Workflow_Administrator&grant_type=client_credentials&client_id=mock&client_secret=mock",
"status": 200,
"response": {
"access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsIng1dCI6InhWTVN1M21xQnZadHJxQ3k5TG81RlJwZVF2NCIsImtpZCI6InhWT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BvFsqtY66iU9cikJdYMsrtspRCNNFnrcKYv3GMa-H6pRzsh3w1uSeNaWD4vnhOqda6OL1_LcTYn5fYv85dtU4DheOlhtfq0vsGI3GnH7UcHN0RKF4x-G9cnn2MHTiMbb75_Pv4-b1F59tpm7D9j-2DTDkd6NVd6SZSQ",
"expires_in": 3600,
"token_type": "Bearer"
},
Expand All @@ -19,40 +28,44 @@
"pragma",
"no-cache",
"content-length",
"1237",
"1251",
"content-type",
"application/json; charset=utf-8",
"access-control-expose-headers",
"x-contensis-classic-token",
"date",
"Tue, 12 Mar 2024 17:14:18 GMT",
"Tue, 08 Oct 2024 12:21:04 GMT",
"x-robots-tag",
"noindex",
"x-content-type-options",
"nosniff",
"referrer-policy",
"strict-origin-when-cross-origin",
"connection",
"close"
"x-backend-name",
"backend_tcp_automotron"
],
"responseIsBinary": false
},
{
"scope": "https://mock-cms.cloud.contensis.com:443",
"method": "GET",
"path": "/api/delivery/projects/canvas/contentTypes/document",
"path": "/api/delivery/projects/canvasPackages/contentTypes/document",
"body": "",
"status": 200,
"response": [
"1f8b0800000000000003000000ffff9453c96edb3010fd171e0bcb902579a96e75d31401da9e7c6a11042371e4b0a548818b03c3f0bf77482d719dfa104097796ff8e6cda2133ba0b1422b569e586d101cf2ed91954cea1a64a234c704ba8ecd4692a82ccdf264912669be5b2ccb7c5516e93cdd641fd37cf393125bcd45236ec98cec5b9d75b9c8e7ab2c5d2f7b9dce5752d8e75b4213fd5fa5629e93a5cdaa084a1c250e7d292fe5048c2198fa591c2e1346648c8721fdd0546c314fd979c6bc17b1f43a5bc30a974995159ba4a8aa2cd9540559a979b5e01cd6bc69c842cce5baf62d2a17dc1bfd1b6bf710e01ad4012c810a5a0c7b40957cdd127137e69f83655b1bd1b97e5504106e8e3be124de0b9441c78580649a105b56fe3af56547fc5a3e3e8edae06077ec8864d619a1f6acc7eeb569c1bd0eedca01c706bc9cf8034841af88b683432e9c3623bd37da77b1df1684a2b283bb9bdd7fee897ffde92a8ced933170bc32f92af43ea30ca4d42fc8438118b7682dec71cc763d4ec374bd850fd1fb103c3506f6c34e39d6da00b57c291b5f4e4cfffcf11cbedb039aeee4fc3899ff066aefa3ad614033667dd76943773c72c1e6c0d2c3176dfe34e4a1bf31ad1c2a2bec9770365bb0a2be9e5f3c2836f8b8389fb8aeb7ebf9de6ff17adad35e2f8efd1d771d3a16aa969ee383ba43493f21992a9df178fe0b0000ffff000000ffff03001b0cfcc2ac040000"
"1f8b080000000000040095534d6fdb300cfd2f3a0e75103bca877d5bd67528b00d3be4b4a118148976b5ca92a18f145990ff3ecab2d32c09300cf0858fe4e3d3237d203bb04e1a4daa03e1169807b1de938afc06dd80f692dc8d3082c5b4a0d9749e15c5665a56b4ac723a29f345be5c2cbf63616b84ace535c188df6298cd277436cb570b1a19bab055d23d5f539c12373956937cb19c976519390428185ea1835227600c99e5cf72775e3022633c58f2d5e0b07c3225c73b12828ca317a2e6c5365f66b4a0d38cf29c662b4a4596b319f02d179c5240097dad303cb4283faab7e61770ff1861cef48eb96f8cbfb0061c26356b21ba0f3afbb4c682fbb1ef18a53b6e65e7d3821040dcee37d22b7890a0229f8f01d2d43176a4fa7148e347fc92be6feeb999679b7d8749e2bc95ba21097b30b665fecdbc0b05026a16d429bf634a6217a6dda050486fec986eac095dffee96498d630775c9851bf23ea4c4dffacc36daf7de5ab6bf10f946f47f420953cabc828803fab805e7702163b54f389ae9938477bdf621f8595bd60cbb15c08d65f8e473dabef39449ed4fc7f8fdcba0a793f0cf4c37a197349873475ce83a63f196c75c943864b1f1d5d8971ae7a73b33da8376d27d8c27b3664ef24beffa63228386b3d3e9955cafe64bdae0a5d351b2d45c05018ffa1e14fe49c85a791b20de2bdbaae8470af147e8c07a1985c7f71fff005f4dbb0480040000"
],
"rawHeaders": [
"cache-control",
"no-store, must-revalidate",
"content-type",
"application/json; charset=utf-8",
"content-encoding",
"gzip",
"origin-content-api-version",
"16.102.0.7591",
"16.102.0.7825",
"x-alias",
"develop",
"automotron",
"access-control-allow-headers",
"accesstoken, authorization, content-type, *",
"access-control-allow-methods",
Expand All @@ -62,64 +75,49 @@
"access-control-expose-headers",
"surrogate-key",
"date",
"Tue, 12 Mar 2024 17:14:18 GMT",
"x-url",
"/api/delivery/projects/canvas/contentTypes/document",
"x-host",
"cms-develop.cloud.contensis.com",
"server-cache-control",
"no-store, must-revalidate",
"server-surrogate-control",
"",
"surrogate-control",
"max-age=3600",
"x-grace",
"72h",
"x-backend-ttl",
"3600.000",
"content-encoding",
"gzip",
"vary",
"Accept-Encoding",
"x-varnish",
"788579",
"x-varnish-authentication",
"skip",
"x-age",
"0",
"cache-control",
"no-store, must-revalidate",
"accept-ranges",
"bytes",
"Tue, 08 Oct 2024 12:21:04 GMT",
"content-length",
"527",
"524",
"x-robots-tag",
"noindex",
"x-content-type-options",
"nosniff",
"referrer-policy",
"strict-origin-when-cross-origin",
"connection",
"close"
"x-backend-name",
"backend_tcp_automotron"
],
"responseIsBinary": false
},
{
"scope": "https://mock-cms.cloud.contensis.com:443",
"method": "GET",
"path": "/api/delivery/projects/canvas",
"path": "/api/delivery/projects/canvasPackages",
"body": "",
"status": 200,
"response": [
"1f8b0800000000000003000000ffff3c8dc10a83301044ff65cf06022a693db6945e7aebb178d824ab046212122395d27f6f14ec71e7cd9bfd80d1d08142b760820a72deef5a21522d056b1417eccc91b3a626c99a5688130d0275cb4bdbe144a57d3d6c4d49451366e35d894b10a29930ae0f7463c671eb9263f74b212987e0e34cfa6009bad79f0e715f83be02e5ad8f459436d31e5ab3505c9f6bbabd95cda9fcdad4fefb030000ffff0300fc6f2a48cb000000"
],
"response": {
"id": "canvasPackages",
"uuid": "b67f69f8-131d-cf94-6211-50624b70df93",
"name": "Canvas packages",
"description": "Data used in automated tests for the canvas packages at github.com/contensis/canvas",
"primaryLanguage": "en-GB",
"supportedLanguages": [
"en-GB"
],
"color": "blue",
"deliverySysExclusions": []
},
"rawHeaders": [
"cache-control",
"no-store, must-revalidate",
"content-length",
"293",
"content-type",
"application/json; charset=utf-8",
"origin-content-api-version",
"16.102.0.7591",
"16.102.0.7825",
"x-alias",
"develop",
"automotron",
"access-control-allow-headers",
"accesstoken, authorization, content-type, *",
"access-control-allow-methods",
Expand All @@ -129,47 +127,17 @@
"access-control-expose-headers",
"surrogate-key",
"date",
"Tue, 12 Mar 2024 17:14:18 GMT",
"x-url",
"/api/delivery/projects/canvas",
"x-host",
"cms-develop.cloud.contensis.com",
"server-cache-control",
"no-store, must-revalidate",
"server-surrogate-control",
"",
"surrogate-control",
"max-age=3600",
"x-grace",
"72h",
"x-backend-ttl",
"3600.000",
"content-encoding",
"gzip",
"vary",
"Accept-Encoding",
"x-varnish",
"854548",
"x-varnish-authentication",
"skip",
"x-age",
"0",
"cache-control",
"no-store, must-revalidate",
"accept-ranges",
"bytes",
"content-length",
"181",
"Tue, 08 Oct 2024 12:21:04 GMT",
"x-robots-tag",
"noindex",
"x-content-type-options",
"nosniff",
"referrer-policy",
"strict-origin-when-cross-origin",
"connection",
"close"
"x-backend-name",
"backend_tcp_automotron"
],
"responseIsBinary": false
}
]
}
}
Loading

0 comments on commit 14f6b28

Please sign in to comment.