@@ -65,6 +65,13 @@ describe('matchPeopleColumns', () => {
6565 } )
6666 } )
6767
68+ it ( 'refuses two columns that name the same field, rather than ignoring one' , ( ) => {
69+ expect ( matchPeopleColumns ( [ 'Email' , 'e-mail' , 'Title' ] ) ) . toEqual ( {
70+ ok : false ,
71+ message : 'The Email and e-mail columns name the same field; keep one' ,
72+ } )
73+ } )
74+
6875 it ( 'refuses a file without an email column, which is how people are matched' , ( ) => {
6976 expect ( matchPeopleColumns ( [ 'name' , 'title' ] ) ) . toEqual ( {
7077 ok : false ,
@@ -215,6 +222,7 @@ describe('planPeopleImport', () => {
215222 [ '2021/3/4' , '2021-03-04' ] ,
216223 [ '3/4/2021' , '2021-03-04' ] ,
217224 [ '2021-03-04T09:00:00Z' , '2021-03-04' ] ,
225+ [ '2021-03-04T09:00:00.123+02:00' , '2021-03-04' ] ,
218226 [ '2021-03-04 09:00' , '2021-03-04' ] ,
219227 ] ) ( 'reads the start date %s' , ( value , startDate ) => {
220228 const result = plan (
@@ -224,22 +232,30 @@ describe('planPeopleImport', () => {
224232 expect ( result . changes ) . toEqual ( [ { memberId : 'm-ada' , profile : profile ( { startDate } ) } ] )
225233 } )
226234
227- it . each ( [ '2021-02-30' , '13/45/2021' , '04.03.2021' , 'March 4' , '1/2/21' , '2021-03-04Tsoon' ] ) (
228- 'skips the row with the unreadable start date %s instead of guessing' ,
229- ( value ) => {
230- const result = plan (
231- [ 'email' , 'start date' ] ,
232- [ { email : 'ada@example.com' , 'start date' : value } ]
233- )
234- expect ( result . changes ) . toEqual ( [ ] )
235- expect ( result . issues ) . toEqual ( [
236- expect . objectContaining ( {
237- severity : 'skipped' ,
238- message : 'Use a start date like 2024-01-31 or 1/31/2024' ,
239- } ) ,
240- ] )
241- }
242- )
235+ it . each ( [
236+ '2021-02-30' ,
237+ '13/45/2021' ,
238+ '04.03.2021' ,
239+ 'March 4' ,
240+ '1/2/21' ,
241+ '2021-03-04Tsoon' ,
242+ '2021-03-04T99:99' ,
243+ '2021-03-04T24:00' ,
244+ '2021-03-04T09:00+99:99' ,
245+ '2021-03/04' ,
246+ ] ) ( 'skips the row with the unreadable start date %s instead of guessing' , ( value ) => {
247+ const result = plan (
248+ [ 'email' , 'start date' ] ,
249+ [ { email : 'ada@example.com' , 'start date' : value } ]
250+ )
251+ expect ( result . changes ) . toEqual ( [ ] )
252+ expect ( result . issues ) . toEqual ( [
253+ expect . objectContaining ( {
254+ severity : 'skipped' ,
255+ message : 'Use a start date like 2024-01-31 or 1/31/2024' ,
256+ } ) ,
257+ ] )
258+ } )
243259
244260 it ( 'leaves the manager as it was when the manager is not a member, and says so' , ( ) => {
245261 const result = plan (
0 commit comments