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
12 changes: 12 additions & 0 deletions .talismanrc
Original file line number Diff line number Diff line change
Expand Up @@ -179,4 +179,16 @@ fileignoreconfig:
checksum: ea4140a1516630fbfcdd61c4fe216414b733b4df2410b5d090d58ab1a22e7dbf
- filename: packages/contentstack-import/test/unit/import/modules/variant-entries.test.ts
checksum: abcc2ce0b305afb655eb46a1652b3d9e807a2a2e0eef1caeb16c8ae83af4f1a1
- filename: packages/contentstack-import/test/unit/utils/import-path-resolver.test.ts
checksum: 05436c24619b2d79b51eda9ce9a338182cc69b078ede60d310bfd55a62db8369
- filename: packages/contentstack-import/test/unit/utils/interactive.test.ts
checksum: 77a45bd7326062053b98d1333fa59147757a5a8abdb34057a347ca2a1b95b343
- filename: packages/contentstack-import/test/unit/utils/import-config-handler.test.ts
checksum: 20bbfb405a183b577f8ae8f2b47013bc42729aa817d617264e0c3a70b3fa752b
- filename: packages/contentstack-import/test/unit/utils/login-handler.test.ts
checksum: bea00781cdffc2d085b3c85d6bde75f12faa3ee51930c92e59777750a6727325
- filename: packages/contentstack-import/test/unit/utils/marketplace-app-helper.test.ts
checksum: eca2702d1f7ed075b9b857964b9e56f69b16e4a31942423d6b1265e4bf398db5
- filename: packages/contentstack-import/test/unit/utils/logger.test.ts
checksum: 794e06e657a7337c8f094d6042fb04c779683f97b860efae14e075098d2af024
version: "1.0"
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import { expect } from 'chai';
import { gfSchemaTemplate } from '../../../src/utils/global-field-helper';

describe('Global Field Helper', () => {
describe('gfSchemaTemplate', () => {
it('should export a schema template object', () => {
expect(gfSchemaTemplate).to.be.an('object');
expect(gfSchemaTemplate).to.have.property('global_field');
});

it('should have correct structure for global_field', () => {
const globalField = gfSchemaTemplate.global_field;

expect(globalField).to.be.an('object');
expect(globalField).to.have.property('title', 'Seed');
expect(globalField).to.have.property('uid', '');
expect(globalField).to.have.property('schema');
expect(globalField).to.have.property('description', '');
});

it('should have schema as an array', () => {
const schema = gfSchemaTemplate.global_field.schema;

expect(schema).to.be.an('array');
expect(schema).to.have.lengthOf(1);
});

it('should have correct structure for first schema field', () => {
const firstField = gfSchemaTemplate.global_field.schema[0];

expect(firstField).to.be.an('object');
expect(firstField).to.have.property('display_name', 'Title');
expect(firstField).to.have.property('uid', 'title');
expect(firstField).to.have.property('data_type', 'text');
expect(firstField).to.have.property('field_metadata');
expect(firstField).to.have.property('unique', false);
expect(firstField).to.have.property('mandatory', true);
expect(firstField).to.have.property('multiple', false);
});

it('should have correct field_metadata structure', () => {
const fieldMetadata = gfSchemaTemplate.global_field.schema[0].field_metadata;

expect(fieldMetadata).to.be.an('object');
expect(fieldMetadata).to.have.property('_default', true);
});
});
});
Loading
Loading