def test_skips_empty_emails(self): doc = { 'name': 'foo', 'maintainers': [{ 'email': '' }, { 'email': ' ' }] } assert sync_npm.process_doc(doc)['emails'] == []
def test_dedupes_emails(self): doc = { 'name': 'foo', 'maintainers': [{ 'email': 'alice' }, { 'email': 'alice' }] } assert sync_npm.process_doc(doc)['emails'] == ['alice']
def test_returns_None_if_no_name(self): assert sync_npm.process_doc({}) is None
def test_backfills_missing_keys(self): actual = sync_npm.process_doc({'name': 'foo'}) assert actual == {'name': 'foo', 'description': '', 'emails': []}
def test_extracts_maintainer_emails(self): doc = {'name': 'foo', 'maintainers': [{'email': '*****@*****.**'}]} assert sync_npm.process_doc(doc)['emails'] == ['*****@*****.**']
def test_dedupes_emails(self): doc = {'name': 'foo', 'maintainers': [{'email': 'alice'}, {'email': 'alice'}]} assert sync_npm.process_doc(doc)['emails'] == ['alice']
def test_skips_empty_emails(self): doc = {'name': 'foo', 'maintainers': [{'email': ''}, {'email': ' '}]} assert sync_npm.process_doc(doc)['emails'] == []