Skip to content

Commit

Permalink
fix: tests
Browse files Browse the repository at this point in the history
  • Loading branch information
barthc committed Jul 23, 2020
1 parent 3b16356 commit c92be7c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion packages/netlify-cms-core/src/backend.ts
Original file line number Diff line number Diff line change
Expand Up @@ -775,7 +775,7 @@ export class Backend {
const extension = selectFolderEntryExtension(collection);
const multiContent = hasMultiContent(collection);
const i18nStructure = collection.get('i18n_structure');
const locales = collection.get('locales')!.toJS() as string[];
const locales = collection?.get('locales')?.toJS() as string[];
let loadedEntries;

if (multiContent && i18nStructure === LOCALE_FILE_EXTENSIONS) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ import { fromJS } from 'immutable';

const values = fromJS({ title: 'New Post', unknown: 'Unknown Field' });
const fields = fromJS([{ name: 'title', widget: 'string' }]);
const collection = fromJS({ name: 'collection' });

describe('serializeValues', () => {
it('should retain unknown fields', () => {
expect(serializeValues(values, fields)).toEqual(
expect(serializeValues(collection, values, fields)).toEqual(
fromJS({ title: 'New Post', unknown: 'Unknown Field' }),
);
});
Expand Down

0 comments on commit c92be7c

Please sign in to comment.