Skip to content

Commit 8df458c

Browse files
committed
Tests: Added test cases for Utilitites Modules
1 parent 2f7f9e9 commit 8df458c

File tree

7 files changed

+2908
-0
lines changed

7 files changed

+2908
-0
lines changed

.talismanrc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,4 +159,14 @@ fileignoreconfig:
159159
checksum: ea4140a1516630fbfcdd61c4fe216414b733b4df2410b5d090d58ab1a22e7dbf
160160
- filename: packages/contentstack-import/test/unit/import/modules/variant-entries.test.ts
161161
checksum: abcc2ce0b305afb655eb46a1652b3d9e807a2a2e0eef1caeb16c8ae83af4f1a1
162+
- filename: packages/contentstack-import/test/unit/utils/import-path-resolver.test.ts
163+
checksum: 05436c24619b2d79b51eda9ce9a338182cc69b078ede60d310bfd55a62db8369
164+
- filename: packages/contentstack-import/test/unit/utils/interactive.test.ts
165+
checksum: 77a45bd7326062053b98d1333fa59147757a5a8abdb34057a347ca2a1b95b343
166+
- filename: packages/contentstack-import/test/unit/utils/import-config-handler.test.ts
167+
checksum: 20bbfb405a183b577f8ae8f2b47013bc42729aa817d617264e0c3a70b3fa752b
168+
- filename: packages/contentstack-import/test/unit/utils/login-handler.test.ts
169+
checksum: bea00781cdffc2d085b3c85d6bde75f12faa3ee51930c92e59777750a6727325
170+
- filename: packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts
171+
checksum: eca2702d1f7ed075b9b857964b9e56f69b16e4a31942423d6b1265e4bf398db5
162172
version: "1.0"
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import { expect } from 'chai';
2+
import { gfSchemaTemplate } from '../../../src/utils/global-field-helper';
3+
4+
describe('Global Field Helper', () => {
5+
describe('gfSchemaTemplate', () => {
6+
it('should export a schema template object', () => {
7+
expect(gfSchemaTemplate).to.be.an('object');
8+
expect(gfSchemaTemplate).to.have.property('global_field');
9+
});
10+
11+
it('should have correct structure for global_field', () => {
12+
const globalField = gfSchemaTemplate.global_field;
13+
14+
expect(globalField).to.be.an('object');
15+
expect(globalField).to.have.property('title', 'Seed');
16+
expect(globalField).to.have.property('uid', '');
17+
expect(globalField).to.have.property('schema');
18+
expect(globalField).to.have.property('description', '');
19+
});
20+
21+
it('should have schema as an array', () => {
22+
const schema = gfSchemaTemplate.global_field.schema;
23+
24+
expect(schema).to.be.an('array');
25+
expect(schema).to.have.lengthOf(1);
26+
});
27+
28+
it('should have correct structure for first schema field', () => {
29+
const firstField = gfSchemaTemplate.global_field.schema[0];
30+
31+
expect(firstField).to.be.an('object');
32+
expect(firstField).to.have.property('display_name', 'Title');
33+
expect(firstField).to.have.property('uid', 'title');
34+
expect(firstField).to.have.property('data_type', 'text');
35+
expect(firstField).to.have.property('field_metadata');
36+
expect(firstField).to.have.property('unique', false);
37+
expect(firstField).to.have.property('mandatory', true);
38+
expect(firstField).to.have.property('multiple', false);
39+
});
40+
41+
it('should have correct field_metadata structure', () => {
42+
const fieldMetadata = gfSchemaTemplate.global_field.schema[0].field_metadata;
43+
44+
expect(fieldMetadata).to.be.an('object');
45+
expect(fieldMetadata).to.have.property('_default', true);
46+
});
47+
});
48+
});

0 commit comments

Comments
 (0)