Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -590,6 +590,7 @@ describe('BaseBulkCommand', () => {
(command as any).bulkOperationConfig = {
publishMode: 'bulk',
apiKey: undefined,
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
stackApiKey: 'fallback-key',
branch: 'main',
bulkOperationFolder: './bulk-operation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ describe('Bulk Operation Log Handler', () => {
locales: ['en-us'],
items: [{ uid: 'entry1' }],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -254,6 +255,7 @@ describe('Bulk Operation Log Handler', () => {
items: [{ uid: 'entry1' }],
status: 'failed',
error: 'Network error',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -351,6 +353,7 @@ describe('Bulk Operation Log Handler', () => {
item: { uid: 'entry1', type: 'entry', locale: 'en-us' },
environments: ['prod'],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -400,6 +403,7 @@ describe('Bulk Operation Log Handler', () => {
environments: ['prod'],
status: 'failed',
error: 'Network error',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -442,6 +446,7 @@ describe('Bulk Operation Log Handler', () => {
locales: ['en-us'],
items: [{ uid: 'entry1', type: 'entry', locale: 'en-us' }],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
};
Expand All @@ -467,6 +472,7 @@ describe('Bulk Operation Log Handler', () => {
locales: ['en-us'],
items: [],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
};
Expand All @@ -492,6 +498,7 @@ describe('Bulk Operation Log Handler', () => {
locales: [],
items: [],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
};
Expand Down Expand Up @@ -528,6 +535,7 @@ describe('Bulk Operation Log Handler', () => {
items: [],
status: 'failed',
error: 'API Error',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
};
Expand Down Expand Up @@ -563,6 +571,7 @@ describe('Bulk Operation Log Handler', () => {
item: { uid: 'entry1', type: 'entry', locale: 'en-us' },
environments: ['prod'],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
};
Expand All @@ -586,6 +595,7 @@ describe('Bulk Operation Log Handler', () => {
item: { uid: 'new-entry', type: 'entry', locale: 'en-us' },
environments: ['prod'],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
};
Expand Down Expand Up @@ -622,6 +632,7 @@ describe('Bulk Operation Log Handler', () => {
environments: ['prod'],
status: 'failed',
error: 'Publish failed',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
};
Expand All @@ -644,6 +655,7 @@ describe('Bulk Operation Log Handler', () => {
item: { uid: 'entry1', type: 'entry', locale: 'en-us' },
environments: [],
status: 'failed',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ describe('Config Builder Utilities', () => {
};

configHandlerGetStub.withArgs('tokens.test-alias').returns({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'stack-from-alias',
token: 'cs-token-123',
});
Expand All @@ -589,6 +590,7 @@ describe('Config Builder Utilities', () => {
};

configHandlerGetStub.withArgs('tokens.test-alias').returns({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'stack-mgmt',
token: 'cs-mgmt-token',
type: 'management',
Expand All @@ -598,6 +600,7 @@ describe('Config Builder Utilities', () => {
type: 'delivery',
token: 'cs-delivery-token',
environment: 'production',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'stack123',
});

Expand All @@ -619,6 +622,7 @@ describe('Config Builder Utilities', () => {
};

configHandlerGetStub.withArgs('tokens.test-alias').returns({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'stack-mgmt',
token: 'cs-mgmt-token',
type: 'management',
Expand All @@ -640,6 +644,7 @@ describe('Config Builder Utilities', () => {
};

configHandlerGetStub.withArgs('tokens.test-alias').returns({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'stack-mgmt',
token: 'cs-mgmt-token',
type: 'management',
Expand All @@ -648,6 +653,7 @@ describe('Config Builder Utilities', () => {
configHandlerGetStub.withArgs('tokens.mgmt-alias').returns({
type: 'management',
token: 'cs-mgmt-token',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'stack123',
});

Expand All @@ -665,6 +671,7 @@ describe('Config Builder Utilities', () => {
};

configHandlerGetStub.withArgs('tokens.test-alias').returns({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'stack-mgmt',
token: 'cs-mgmt-token',
type: 'management',
Expand All @@ -674,6 +681,7 @@ describe('Config Builder Utilities', () => {
type: 'delivery',
token: 'cs-delivery-token',
environment: 'production', // Different from source-env
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'stack123',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ describe('Revert Retry Handler', () => {
items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }],
status: 'failed',
error: 'Network timeout',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand All @@ -86,6 +87,7 @@ describe('Revert Retry Handler', () => {
locales: ['en-us'],
items: [{ uid: 'asset1', locale: 'en-us', version: 1, type: 'asset' }],
status: 'failed',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -121,6 +123,7 @@ describe('Revert Retry Handler', () => {
locales: ['en-us'],
items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -161,6 +164,7 @@ describe('Revert Retry Handler', () => {
locales: ['en-us'],
items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }],
status: 'failed',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -201,6 +205,7 @@ describe('Revert Retry Handler', () => {
locales: ['en-us'],
items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }],
status: 'success',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -260,6 +265,7 @@ describe('Revert Retry Handler', () => {
locales: ['en-us'],
items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' }],
status: 'failed',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -295,6 +301,7 @@ describe('Revert Retry Handler', () => {
locales: ['en-us'],
items: [{ uid: 'asset1', locale: 'en-us', version: 1, type: 'asset' }],
status: 'failed',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down Expand Up @@ -337,6 +344,7 @@ describe('Revert Retry Handler', () => {
locales: ['en-us'],
items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' as const }],
status: 'success' as const,
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand All @@ -360,6 +368,7 @@ describe('Revert Retry Handler', () => {
locales: ['en-us'],
items: [{ uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' as const }],
status: 'success' as const,
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand All @@ -380,6 +389,7 @@ describe('Revert Retry Handler', () => {
item: { uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' as const },
environments: ['prod'],
status: 'success' as const,
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand All @@ -400,6 +410,7 @@ describe('Revert Retry Handler', () => {
item: { uid: 'entry1', locale: 'en-us', contentType: 'blog', version: 1, type: 'entry' as const },
environments: ['prod'],
status: 'success' as const,
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'test-key',
branch: 'main',
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ describe('Stack Clone Test', () => {

describe('createNewStack', () => {
it('should call createNewStack', async () => {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
const createNewStackStub = sandbox.stub(handler, 'createNewStack').resolves({ api_key: 'test-key' });
await handler.createNewStack({ orgUid: 'dummyOrg' });
expect(createNewStackStub.calledOnce).to.be.true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ describe('Command Helpers', () => {
executeDestination: async () => {},
cmdExport: async () => true,
setBranch: async () => {},
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
createNewStack: async (params: any) => ({ api_key: 'test-key' }),
cloneTypeSelection: async () => 'success',
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ describe('CloneHandler - Branch', () => {
try {
await handler.resolveBranchAliases(true);
// If it doesn't throw, verify stack was called
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
expect(mockClient.stack.calledWith({ api_key: 'test-source-key' })).to.be.true;
} catch (error) {
// Expected to fail due to actual function call without proper setup
expect(error).to.exist;
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
expect(mockClient.stack.calledWith({ api_key: 'test-source-key' })).to.be.true;
}
});
Expand All @@ -120,10 +122,12 @@ describe('CloneHandler - Branch', () => {

try {
await handler.resolveBranchAliases(false);
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
expect(mockClient.stack.calledWith({ api_key: 'test-target-key' })).to.be.true;
} catch (error) {
// Expected to fail due to actual function call without proper setup
expect(error).to.exist;
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
expect(mockClient.stack.calledWith({ api_key: 'test-target-key' })).to.be.true;
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,15 @@ jest.mock('@contentstack/cli-command', () => ({
error = jest.fn()
warn = jest.fn()
getToken(_alias: string) {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
return { apiKey: 'default-api', type: 'management' }
}
},
}))

jest.mock('@contentstack/cli-utilities', () => ({
authenticationHandler: {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
accessToken: 'auth-token',
getAuthDetails: jest.fn(),
},
Expand Down Expand Up @@ -149,6 +151,7 @@ describe('ContentTypeCommand', () => {

it('sets apiKey from alias token and warns on delivery token', async () => {
jest.spyOn(cmd, 'getToken').mockReturnValue({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'from-token',
type: 'delivery',
} as any)
Expand All @@ -162,6 +165,7 @@ describe('ContentTypeCommand', () => {

it('sets apiKey from management token alias without warning', async () => {
jest.spyOn(cmd, 'getToken').mockReturnValue({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
apiKey: 'mgmt-key',
type: 'management',
} as any)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ describe('ContentstackClient', () => {
expect(mockGet).toHaveBeenCalledWith(
'/audit-logs',
expect.objectContaining({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
headers: { api_key: 'stack-key' },
params: {
query: {
Expand Down Expand Up @@ -106,6 +107,7 @@ describe('ContentstackClient', () => {
await client.getContentTypeReferences('stack-key', 'ct-uid', spinner)

expect(mockGet).toHaveBeenCalledWith('/content_types/ct-uid/references', {
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
headers: { api_key: 'stack-key' },
params: { include_global_fields: true }
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ describe('utils/index', () => {
const sdk = stackFactory({})
const stack = await getStack(sdk, 'api-key-1', spinner)
expect(stack).toEqual({
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
api_key: 'api-key-1',
master_locale: 'en-us',
name: 'Stack',
org_uid: 'org-1',
uid: 'stack-uid'
})
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
expect(sdk.stack).toHaveBeenCalledWith({ api_key: 'api-key-1' })
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ describe('error-handler', () => {
it('should append api_key error details', () => {
const error = {
errorMessage: 'Invalid request',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
errors: { api_key: 'is required' },
};
const result = formatError(error);
Expand All @@ -81,6 +82,7 @@ describe('error-handler', () => {
it('should append access_token error details', () => {
const error = {
errorMessage: 'Unauthorized',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
errors: { access_token: 'is expired' },
};
const result = formatError(error);
Expand All @@ -93,6 +95,7 @@ describe('error-handler', () => {
errorMessage: 'Multiple errors',
errors: {
authorization: 'is invalid',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
api_key: 'is missing',
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ describe('Common Helper Utils', () => {
errorMessage: 'Main error',
errors: {
authorization: 'Invalid token',
// deepcode ignore HardcodedNonCryptoSecret: test fixture value, not a real secret
api_key: 'Invalid key'
}
};
Expand Down
Loading
Loading